blob: 53f4d773b40d9f40a229fdd930fbf52a7cb43971 [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
Jeff Browna492c3a2012-08-23 19:48:44 -070019import android.app.Presentation;
20import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.content.pm.ActivityInfo;
22import android.graphics.PixelFormat;
23import android.os.IBinder;
24import android.os.Parcel;
25import android.os.Parcelable;
26import android.text.TextUtils;
27import android.util.Log;
28
29
30/**
31 * The interface that apps use to talk to the window manager.
32 * <p>
33 * Use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> to get one of these.
Jeff Browna492c3a2012-08-23 19:48:44 -070034 * </p><p>
35 * Each window manager instance is bound to a particular {@link Display}.
36 * To obtain a {@link WindowManager} for a different display, use
37 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
38 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
39 * to get the WindowManager.
40 * </p><p>
41 * The simplest way to show a window on another display is to create a
42 * {@link Presentation}. The presentation will automatically obtain a
43 * {@link WindowManager} and {@link Context} for that display.
44 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045 *
46 * @see android.content.Context#getSystemService
47 * @see android.content.Context#WINDOW_SERVICE
48 */
49public interface WindowManager extends ViewManager {
50 /**
51 * Exception that is thrown when trying to add view whose
52 * {@link WindowManager.LayoutParams} {@link WindowManager.LayoutParams#token}
53 * is invalid.
54 */
55 public static class BadTokenException extends RuntimeException {
56 public BadTokenException() {
57 }
58
59 public BadTokenException(String name) {
60 super(name);
61 }
62 }
63
64 /**
Craig Mautner6018aee2012-10-23 14:27:49 -070065 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
66 * be found. See {@link android.app.Presentation} for more information on secondary displays.
67 */
68 public static class InvalidDisplayException extends RuntimeException {
69 public InvalidDisplayException() {
70 }
71
72 public InvalidDisplayException(String name) {
73 super(name);
74 }
75 }
76
77 /**
Jeff Browna492c3a2012-08-23 19:48:44 -070078 * Returns the {@link Display} upon which this {@link WindowManager} instance
79 * will create new windows.
80 * <p>
81 * Despite the name of this method, the display that is returned is not
82 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
83 * The returned display could instead be a secondary display that this
84 * window manager instance is managing. Think of it as the display that
85 * this {@link WindowManager} instance uses by default.
86 * </p><p>
87 * To create windows on a different display, you need to obtain a
88 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
89 * class documentation for more information.)
90 * </p>
91 *
92 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 */
94 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -070095
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 /**
97 * Special variation of {@link #removeView} that immediately invokes
98 * the given view hierarchy's {@link View#onDetachedFromWindow()
99 * View.onDetachedFromWindow()} methods before returning. This is not
100 * for normal applications; using it correctly requires great care.
101 *
102 * @param view The view to be removed.
103 */
104 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700105
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106 public static class LayoutParams extends ViewGroup.LayoutParams
107 implements Parcelable {
108 /**
109 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700110 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
111 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 */
Romain Guy529b60a2010-08-03 18:05:47 -0700113 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800114 public int x;
115
116 /**
117 * Y position for this window. With the default gravity it is ignored.
118 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
119 * an offset from the given edge.
120 */
Romain Guy529b60a2010-08-03 18:05:47 -0700121 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 public int y;
123
124 /**
125 * Indicates how much of the extra space will be allocated horizontally
126 * to the view associated with these LayoutParams. Specify 0 if the view
127 * should not be stretched. Otherwise the extra pixels will be pro-rated
128 * among all views whose weight is greater than 0.
129 */
Romain Guy529b60a2010-08-03 18:05:47 -0700130 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 public float horizontalWeight;
132
133 /**
134 * Indicates how much of the extra space will be allocated vertically
135 * to the view associated with these LayoutParams. Specify 0 if the view
136 * should not be stretched. Otherwise the extra pixels will be pro-rated
137 * among all views whose weight is greater than 0.
138 */
Romain Guy529b60a2010-08-03 18:05:47 -0700139 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700141
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 /**
143 * The general type of window. There are three main classes of
144 * window types:
145 * <ul>
146 * <li> <strong>Application windows</strong> (ranging from
147 * {@link #FIRST_APPLICATION_WINDOW} to
148 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
149 * windows. For these types of windows, the {@link #token} must be
150 * set to the token of the activity they are a part of (this will
151 * normally be done for you if {@link #token} is null).
152 * <li> <strong>Sub-windows</strong> (ranging from
153 * {@link #FIRST_SUB_WINDOW} to
154 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
155 * window. For these types of windows, the {@link #token} must be
156 * the token of the window it is attached to.
157 * <li> <strong>System windows</strong> (ranging from
158 * {@link #FIRST_SYSTEM_WINDOW} to
159 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
160 * use by the system for specific purposes. They should not normally
161 * be used by applications, and a special permission is required
162 * to use them.
163 * </ul>
164 *
165 * @see #TYPE_BASE_APPLICATION
166 * @see #TYPE_APPLICATION
167 * @see #TYPE_APPLICATION_STARTING
168 * @see #TYPE_APPLICATION_PANEL
169 * @see #TYPE_APPLICATION_MEDIA
170 * @see #TYPE_APPLICATION_SUB_PANEL
171 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
172 * @see #TYPE_STATUS_BAR
173 * @see #TYPE_SEARCH_BAR
174 * @see #TYPE_PHONE
175 * @see #TYPE_SYSTEM_ALERT
176 * @see #TYPE_KEYGUARD
177 * @see #TYPE_TOAST
178 * @see #TYPE_SYSTEM_OVERLAY
179 * @see #TYPE_PRIORITY_PHONE
180 * @see #TYPE_STATUS_BAR_PANEL
181 * @see #TYPE_SYSTEM_DIALOG
182 * @see #TYPE_KEYGUARD_DIALOG
183 * @see #TYPE_SYSTEM_ERROR
184 * @see #TYPE_INPUT_METHOD
185 * @see #TYPE_INPUT_METHOD_DIALOG
186 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700187 @ViewDebug.ExportedProperty(mapping = {
188 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
189 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
190 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
191 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
192 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
193 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
194 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700195 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700196 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
197 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
198 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
199 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
200 @ViewDebug.IntToString(from = TYPE_KEYGUARD, to = "TYPE_KEYGUARD"),
201 @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
202 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
203 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700204 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"),
205 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
206 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
207 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
Jeff Brown3b2b3542010-10-15 00:54:27 -0700208 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700209 @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
210 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700211 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700212 @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
213 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
214 @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
215 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
216 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700217 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
218 @ViewDebug.IntToString(from = TYPE_HIDDEN_NAV_CONSUMER, to = "TYPE_HIDDEN_NAV_CONSUMER"),
219 @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
Jeff Brownbd6e1502012-08-28 03:27:37 -0700220 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"),
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700221 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"),
keunyounga446bf02013-06-21 19:07:57 -0700222 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY"),
keunyounge3d2cc82013-07-12 16:55:44 -0700223 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700224 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800225 public int type;
226
227 /**
228 * Start of window types that represent normal application windows.
229 */
230 public static final int FIRST_APPLICATION_WINDOW = 1;
231
232 /**
233 * Window type: an application window that serves as the "base" window
234 * of the overall application; all other application windows will
235 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700236 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800237 */
238 public static final int TYPE_BASE_APPLICATION = 1;
239
240 /**
241 * Window type: a normal application window. The {@link #token} must be
242 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700243 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800244 */
245 public static final int TYPE_APPLICATION = 2;
246
247 /**
248 * Window type: special application window that is displayed while the
249 * application is starting. Not for use by applications themselves;
250 * this is used by the system to display something until the
251 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700252 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253 */
254 public static final int TYPE_APPLICATION_STARTING = 3;
255
256 /**
257 * End of types of application windows.
258 */
259 public static final int LAST_APPLICATION_WINDOW = 99;
260
261 /**
262 * Start of types of sub-windows. The {@link #token} of these windows
263 * must be set to the window they are attached to. These types of
264 * windows are kept next to their attached window in Z-order, and their
265 * coordinate space is relative to their attached window.
266 */
267 public static final int FIRST_SUB_WINDOW = 1000;
268
269 /**
270 * Window type: a panel on top of an application window. These windows
271 * appear on top of their attached window.
272 */
273 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
274
275 /**
John Spurlock33291d82013-03-13 14:45:14 -0400276 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800277 * are displayed behind their attached window.
278 */
279 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1;
280
281 /**
282 * Window type: a sub-panel on top of an application window. These
283 * windows are displayed on top their attached window and any
284 * {@link #TYPE_APPLICATION_PANEL} panels.
285 */
286 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW+2;
287
288 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
289 * of the window happens as that of a top-level window, <em>not</em>
290 * as a child of its container.
291 */
292 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3;
293
294 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700295 * Window type: window for showing overlays on top of media windows.
296 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
297 * application window. They should be translucent to be useful. This
298 * is a big ugly hack so:
299 * @hide
300 */
301 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4;
302
303 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800304 * End of types of sub-windows.
305 */
306 public static final int LAST_SUB_WINDOW = 1999;
307
308 /**
309 * Start of system-specific window types. These are not normally
310 * created by applications.
311 */
312 public static final int FIRST_SYSTEM_WINDOW = 2000;
313
314 /**
315 * Window type: the status bar. There can be only one status bar
316 * window; it is placed at the top of the screen, and all other
317 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700318 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800319 */
320 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
321
322 /**
323 * Window type: the search bar. There can be only one search bar
324 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700325 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 */
327 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
328
329 /**
330 * Window type: phone. These are non-application windows providing
331 * user interaction with the phone (in particular incoming calls).
332 * These windows are normally placed above all applications, but behind
333 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700334 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 */
336 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
337
338 /**
339 * Window type: system window, such as low power alert. These windows
340 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700341 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800342 */
343 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
344
345 /**
346 * Window type: keyguard window.
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_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
350
351 /**
352 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700353 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 */
355 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
356
357 /**
358 * Window type: system overlay windows, which need to be displayed
359 * on top of everything else. These windows must not take input
360 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700361 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800362 */
363 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
364
365 /**
366 * Window type: priority phone UI, which needs to be displayed even if
367 * the keyguard is active. These windows must not take input
368 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700369 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 */
371 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
372
373 /**
374 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700375 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800376 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800377 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
378
379 /**
380 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700381 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800382 */
383 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
384
385 /**
386 * Window type: internal system error windows, appear on top of
387 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700388 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389 */
390 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
391
392 /**
393 * Window type: internal input methods windows, which appear above
394 * the normal UI. Application windows may be resized or panned to keep
395 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700396 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800397 */
398 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
399
400 /**
401 * Window type: internal input methods dialog windows, which appear above
402 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700403 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800404 */
405 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
406
407 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700408 * Window type: wallpaper window, placed behind any window that wants
409 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700410 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700411 */
412 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
413
414 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800415 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700416 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800417 */
418 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700419
420 /**
421 * Window type: secure system overlay windows, which need to be displayed
422 * on top of everything else. These windows must not take input
423 * focus, or they will interfere with the keyguard.
424 *
425 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
426 * system itself is allowed to create these overlays. Applications cannot
427 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700428 *
429 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700430 * @hide
431 */
432 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
433
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800434 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700435 * Window type: the drag-and-drop pseudowindow. There is only one
436 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700437 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700438 * @hide
439 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700440 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700441
442 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800443 * Window type: panel that slides out from under the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700444 * In multiuser systems shows on all users' windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800445 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800446 */
447 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
448
Jeff Brown83c09682010-12-23 17:50:18 -0800449 /**
450 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700451 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800452 * @hide
453 */
454 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800455
456 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400457 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700458 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400459 * @hide
460 */
461 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
462
463 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700464 * Window type: The volume level overlay/dialog shown when the user
465 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700466 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700467 * @hide
468 */
469 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
470
471 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700472 * Window type: The boot progress dialog, goes on top of everything
473 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700474 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700475 * @hide
476 */
477 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
478
479 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700480 * Window type: Fake window to consume touch events when the navigation
481 * bar is hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700482 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700483 * @hide
484 */
485 public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22;
486
487 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500488 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700489 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500490 * @hide
491 */
492 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
493
494 /**
Jim Millere898ac52012-04-06 17:10:57 -0700495 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700496 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700497 * @hide
498 */
499 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
500
501 /**
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700502 * Window type: Behind the universe of the real windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700503 * In multiuser systems shows on all users' windows.
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700504 * @hide
505 */
506 public static final int TYPE_UNIVERSE_BACKGROUND = FIRST_SYSTEM_WINDOW+25;
507
508 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700509 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700510 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700511 * @hide
512 */
513 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
514
515 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700516 * Window type: Magnification overlay window. Used to highlight the magnified
517 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -0700518 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700519 * @hide
520 */
521 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
522
523 /**
Craig Mautner88400d32012-09-30 12:35:45 -0700524 * Window type: Recents. Same layer as {@link #TYPE_SYSTEM_DIALOG} but only appears on
525 * one user's screen.
526 * In multiuser systems shows on all users' windows.
527 * @hide
528 */
529 public static final int TYPE_RECENTS_OVERLAY = FIRST_SYSTEM_WINDOW+28;
530
Jim Miller5ecd8112013-01-09 18:50:26 -0800531
532 /**
533 * Window type: keyguard scrim window. Shows if keyguard needs to be restarted.
534 * In multiuser systems shows on all users' windows.
535 * @hide
536 */
537 public static final int TYPE_KEYGUARD_SCRIM = FIRST_SYSTEM_WINDOW+29;
538
Craig Mautner88400d32012-09-30 12:35:45 -0700539 /**
keunyounga446bf02013-06-21 19:07:57 -0700540 * Window type: Window for Presentation on top of private
541 * virtual display.
542 */
543 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
544
545 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800546 * End of types of system windows.
547 */
548 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549
Mathias Agopiand2112302010-12-07 19:38:17 -0800550 /** @deprecated this is ignored, this value is set automatically when needed. */
551 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800553 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700554 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800555 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800556 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700557 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800558 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800559 /** @deprecated this is ignored, this value is set automatically when needed. */
560 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800561 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700562
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800563 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700564 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800565 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700566 @Deprecated
567 public int memoryType;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800568
Mike Lockwoodef731622010-01-27 17:51:34 -0500569 /** Window flag: as long as this window is visible to the user, allow
570 * the lock screen to activate while the screen is on.
571 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800572 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500573 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575 /** Window flag: everything behind this window will be dimmed.
576 * Use {@link #dimAmount} to control the amount of dim. */
577 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700578
579 /** Window flag: blur everything behind this window.
580 * @deprecated Blurring is no longer supported. */
581 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800582 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700583
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800584 /** Window flag: this window won't ever get key input focus, so the
585 * user can not send key or other button events to it. Those will
586 * instead go to whatever focusable window is behind it. This flag
587 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
588 * is explicitly set.
589 *
590 * <p>Setting this flag also implies that the window will not need to
591 * interact with
592 * a soft input method, so it will be Z-ordered and positioned
593 * independently of any active input method (typically this means it
594 * gets Z-ordered on top of the input method, so it can use the full
595 * screen for its content and cover the input method if needed. You
596 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
597 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
598
599 /** Window flag: this window can never receive touch events. */
600 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
601
John Spurlock33291d82013-03-13 14:45:14 -0400602 /** Window flag: even when this window is focusable (its
603 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800604 * outside of the window to be sent to the windows behind it. Otherwise
605 * it will consume all pointer events itself, regardless of whether they
606 * are inside of the window. */
607 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
608
John Spurlock33291d82013-03-13 14:45:14 -0400609 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800610 * screen is pressed, you will receive this first touch event. Usually
611 * the first touch event is consumed by the system since the user can
612 * not see what they are pressing on.
613 */
614 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
615
616 /** Window flag: as long as this window is visible to the user, keep
617 * the device's screen turned on and bright. */
618 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
619
620 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -0400621 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 * window must correctly position its contents to take the screen
623 * decoration into account. This flag is normally set for you
624 * by Window as described in {@link Window#setFlags}. */
625 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
626
627 /** Window flag: allow window to extend outside of the screen. */
628 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
629
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800630 /**
John Spurlock33291d82013-03-13 14:45:14 -0400631 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800632 * this window is displayed. This allows the window to use the entire
633 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -0700634 * an app window with this flag set is on the top layer. A fullscreen window
635 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
636 * {@link #softInputMode} field; the window will stay fullscreen
637 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800638 *
639 * <p>This flag can be controlled in your theme through the
640 * {@link android.R.attr#windowFullscreen} attribute; this attribute
641 * is automatically set for you in the standard fullscreen themes
642 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
643 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
644 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
645 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
646 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
647 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
648 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
649 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800650 public static final int FLAG_FULLSCREEN = 0x00000400;
651
John Spurlock33291d82013-03-13 14:45:14 -0400652 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
653 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800654 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
655
656 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700657 * the screen.
658 * @deprecated This flag is no longer used. */
659 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800660 public static final int FLAG_DITHER = 0x00001000;
661
John Spurlock33291d82013-03-13 14:45:14 -0400662 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -0700663 * it from appearing in screenshots or from being viewed on non-secure
664 * displays.
665 *
666 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
667 * secure surfaces and secure displays.
668 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800669 public static final int FLAG_SECURE = 0x00002000;
670
671 /** Window flag: a special mode where the layout parameters are used
672 * to perform scaling of the surface when it is composited to the
673 * screen. */
674 public static final int FLAG_SCALED = 0x00004000;
675
676 /** Window flag: intended for windows that will often be used when the user is
677 * holding the screen against their face, it will aggressively filter the event
678 * stream to prevent unintended presses in this situation that may not be
679 * desired for a particular window, when such an event stream is detected, the
680 * application will receive a CANCEL motion event to indicate this so applications
681 * can handle this accordingly by taking no action on the event
682 * until the finger is released. */
683 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
684
685 /** Window flag: a special option only for use in combination with
686 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
687 * screen your window may appear on top of or behind screen decorations
688 * such as the status bar. By also including this flag, the window
689 * manager will report the inset rectangle needed to ensure your
690 * content is not covered by screen decorations. This flag is normally
691 * set for you by Window as described in {@link Window#setFlags}.*/
692 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
693
694 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
695 * respect to how this window interacts with the current method. That
696 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
697 * window will behave as if it needs to interact with the input method
698 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
699 * not set and this flag is set, then the window will behave as if it
700 * doesn't need to interact with the input method and can be placed
701 * to use more space and cover the input method.
702 */
703 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
704
705 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
706 * can set this flag to receive a single special MotionEvent with
707 * the action
708 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
709 * touches that occur outside of your window. Note that you will not
710 * receive the full down/move/up gesture, only the location of the
711 * first down as an ACTION_OUTSIDE.
712 */
713 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
714
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700715 /** Window flag: special flag to let windows be shown when the screen
716 * is locked. This will let application windows take precedence over
717 * key guard or any other lock screens. Can be used with
718 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700719 * directly before showing the key guard window. Can be used with
720 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
721 * non-secure keyguards. This flag only applies to the top-most
722 * full-screen window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700723 */
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700724 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
725
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700726 /** Window flag: ask that the system wallpaper be shown behind
727 * your window. The window surface must be translucent to be able
728 * to actually see the wallpaper behind it; this flag just ensures
729 * that the wallpaper surface will be there if this window actually
730 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800731 *
732 * <p>This flag can be controlled in your theme through the
733 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
734 * is automatically set for you in the standard wallpaper themes
735 * such as {@link android.R.style#Theme_Wallpaper},
736 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
737 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
738 * {@link android.R.style#Theme_Holo_Wallpaper},
739 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
740 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
741 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700742 */
743 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
744
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700745 /** Window flag: when set as a window is being added or made
746 * visible, once the window has been shown then the system will
747 * poke the power manager's user activity (as if the user had woken
748 * up the device) to turn the screen on. */
749 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
750
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700751 /** Window flag: when set the window will cause the keyguard to
752 * be dismissed, only if it is not a secure lock keyguard. Because such
753 * a keyguard is not needed for security, it will never re-appear if
754 * the user navigates to another window (in contrast to
755 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
756 * hide both secure and non-secure keyguards but ensure they reappear
757 * when the user moves to another UI that doesn't hide them).
758 * If the keyguard is currently active and is secure (requires an
759 * unlock pattern) than the user will still need to confirm it before
760 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
Daniel Sandlerae069f72010-06-17 21:56:26 -0400761 * also been set.
762 */
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700763 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
Jeff Brown01ce2e92010-09-26 22:20:12 -0700764
765 /** Window flag: when set the window will accept for touch events
766 * outside of its bounds to be sent to other windows that also
767 * support split touch. When this flag is not set, the first pointer
768 * that goes down determines the window to which all subsequent touches
769 * go until all pointers go up. When this flag is set, each pointer
770 * (not necessarily the first) that goes down determines the window
771 * to which all subsequent touches of that pointer will go until that
772 * pointer goes up thereby enabling touches with multiple pointers
773 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800774 */
Jeff Brown01ce2e92010-09-26 22:20:12 -0700775 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800776
777 /**
Romain Guy72f0a272011-01-09 16:01:46 -0800778 * <p>Indicates whether this window should be hardware accelerated.
779 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800780 *
Romain Guy72f0a272011-01-09 16:01:46 -0800781 * <p>This flag can be controlled programmatically <em>only</em> to enable
782 * hardware acceleration. To enable hardware acceleration for a given
783 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800784 *
Romain Guy72f0a272011-01-09 16:01:46 -0800785 * <pre>
786 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
787 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
788 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
789 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800790 *
Romain Guy72f0a272011-01-09 16:01:46 -0800791 * <p>It is important to remember that this flag <strong>must</strong>
792 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800793 *
Romain Guy72f0a272011-01-09 16:01:46 -0800794 * <p>This flag cannot be used to disable hardware acceleration after it
795 * was enabled in your manifest using
796 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
797 * and programmatically disable hardware acceleration (for automated testing
798 * for instance), make sure it is turned off in your manifest and enable it
799 * on your activity or dialog when you need it instead, using the method
800 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800801 *
Romain Guy72f0a272011-01-09 16:01:46 -0800802 * <p>This flag is automatically set by the system if the
803 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
804 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800805 */
806 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -0400807
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800808 /**
809 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -0800810 * overscan area, if there is one. The window should still correctly
811 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800812 *
813 * <p>This flag can be controlled in your theme through the
814 * {@link android.R.attr#windowOverscan} attribute; this attribute
815 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -0700816 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800817 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
818 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
819 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
820 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
821 *
822 * <p>When this flag is enabled for a window, its normal content may be obscured
823 * to some degree by the overscan region of the display. To ensure key parts of
824 * that content are visible to the user, you can use
825 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
826 * to set the point in the view hierarchy where the appropriate offsets should
827 * be applied. (This can be done either by directly calling this function, using
828 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
829 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
830 * View.fitSystemWindows(Rect)} method).</p>
831 *
832 * <p>This mechanism for positioning content elements is identical to its equivalent
833 * use with layout and {@link View#setSystemUiVisibility(int)
834 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
835 * position its UI elements with this overscan flag is set:</p>
836 *
837 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -0800838 */
839 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
840
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800841 // ----- HIDDEN FLAGS.
842 // These start at the high bit and go down.
Jeff Brown98db5fa2011-06-08 15:37:10 -0700843
Adam Lesinski6a591f52013-10-01 18:11:17 -0700844 /**
845 * Flag for a window in local focus mode.
846 * Window in local focus mode can control focus independent of window manager using
847 * {@link Window#setLocalFocus(boolean, boolean)}.
848 * Usually window in this mode will not get touch/key events from window manager, but will
849 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
850 */
851 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
852
Jeff Brown98db5fa2011-06-08 15:37:10 -0700853 /** Window flag: Enable touches to slide out of a window into neighboring
854 * windows in mid-gesture instead of being captured for the duration of
855 * the gesture.
856 *
857 * This flag changes the behavior of touch focus for this window only.
858 * Touches can slide out of the window but they cannot necessarily slide
859 * back in (unless the other window with touch focus permits it).
860 *
861 * {@hide}
862 */
Adam Lesinski6a591f52013-10-01 18:11:17 -0700863 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -0700864
Daniel Sandlere02d8082010-10-08 15:13:22 -0400865 /**
866 * Flag for a window belonging to an activity that responds to {@link KeyEvent#KEYCODE_MENU}
867 * and therefore needs a Menu key. For devices where Menu is a physical button this flag is
868 * ignored, but on devices where the Menu key is drawn in software it may be hidden unless
869 * this flag is set.
870 *
871 * (Note that Action Bars, when available, are the preferred way to offer additional
872 * functions otherwise accessed via an options menu.)
873 *
874 * {@hide}
875 */
Adam Lesinski6a591f52013-10-01 18:11:17 -0700876 public static final int FLAG_NEEDS_MENU_KEY = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -0400877
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800878
879 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700880 * Various behavioral options/flags. Default is none.
881 *
882 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
883 * @see #FLAG_DIM_BEHIND
884 * @see #FLAG_NOT_FOCUSABLE
885 * @see #FLAG_NOT_TOUCHABLE
886 * @see #FLAG_NOT_TOUCH_MODAL
887 * @see #FLAG_TOUCHABLE_WHEN_WAKING
888 * @see #FLAG_KEEP_SCREEN_ON
889 * @see #FLAG_LAYOUT_IN_SCREEN
890 * @see #FLAG_LAYOUT_NO_LIMITS
891 * @see #FLAG_FULLSCREEN
892 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700893 * @see #FLAG_SECURE
894 * @see #FLAG_SCALED
895 * @see #FLAG_IGNORE_CHEEK_PRESSES
896 * @see #FLAG_LAYOUT_INSET_DECOR
897 * @see #FLAG_ALT_FOCUSABLE_IM
898 * @see #FLAG_WATCH_OUTSIDE_TOUCH
899 * @see #FLAG_SHOW_WHEN_LOCKED
900 * @see #FLAG_SHOW_WALLPAPER
901 * @see #FLAG_TURN_SCREEN_ON
902 * @see #FLAG_DISMISS_KEYGUARD
903 * @see #FLAG_SPLIT_TOUCH
904 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -0700905 * @see #FLAG_LOCAL_FOCUS_MODE
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700906 */
907 @ViewDebug.ExportedProperty(flagMapping = {
908 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
909 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
910 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
911 name = "FLAG_DIM_BEHIND"),
912 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
913 name = "FLAG_BLUR_BEHIND"),
914 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
915 name = "FLAG_NOT_FOCUSABLE"),
916 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
917 name = "FLAG_NOT_TOUCHABLE"),
918 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
919 name = "FLAG_NOT_TOUCH_MODAL"),
920 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
921 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
922 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
923 name = "FLAG_KEEP_SCREEN_ON"),
924 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
925 name = "FLAG_LAYOUT_IN_SCREEN"),
926 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
927 name = "FLAG_LAYOUT_NO_LIMITS"),
928 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
929 name = "FLAG_FULLSCREEN"),
930 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
931 name = "FLAG_FORCE_NOT_FULLSCREEN"),
932 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
933 name = "FLAG_DITHER"),
934 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
935 name = "FLAG_SECURE"),
936 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
937 name = "FLAG_SCALED"),
938 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
939 name = "FLAG_IGNORE_CHEEK_PRESSES"),
940 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
941 name = "FLAG_LAYOUT_INSET_DECOR"),
942 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
943 name = "FLAG_ALT_FOCUSABLE_IM"),
944 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
945 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
946 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
947 name = "FLAG_SHOW_WHEN_LOCKED"),
948 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
949 name = "FLAG_SHOW_WALLPAPER"),
950 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
951 name = "FLAG_TURN_SCREEN_ON"),
952 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
953 name = "FLAG_DISMISS_KEYGUARD"),
954 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
955 name = "FLAG_SPLIT_TOUCH"),
956 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
keunyoung30f420f2013-08-02 14:23:10 -0700957 name = "FLAG_HARDWARE_ACCELERATED"),
958 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
959 name = "FLAG_LOCAL_FOCUS_MODE")
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700960 })
961 public int flags;
962
963 /**
964 * If the window has requested hardware acceleration, but this is not
965 * allowed in the process it is in, then still render it as if it is
966 * hardware accelerated. This is used for the starting preview windows
967 * in the system process, which don't need to have the overhead of
968 * hardware acceleration (they are just a static rendering), but should
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900969 * be rendered as such to match the actual window of the app even if it
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700970 * is hardware accelerated.
971 * Even if the window isn't hardware accelerated, still do its rendering
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900972 * as if it was.
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700973 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
974 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
975 * is generally disabled. This flag must be specified in addition to
976 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
977 * windows.
978 *
979 * @hide
980 */
981 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
982
983 /**
984 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900985 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700986 * If certain parts of the UI that really do want to use hardware
987 * acceleration, this flag can be set to force it. This is basically
988 * for the lock screen. Anyone else using it, you are probably wrong.
989 *
990 * @hide
991 */
992 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
993
994 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -0700995 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900996 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -0700997 * them (they do not affect the wallpaper scrolling operation) by calling
998 * {@link
999 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1000 *
1001 * @hide
1002 */
1003 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1004
1005 /**
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001006 * This is set for a window that has explicitly specified its
1007 * FLAG_NEEDS_MENU_KEY, so we know the value on this window is the
1008 * appropriate one to use. If this is not set, we should look at
1009 * windows behind it to determine the appropriate value.
1010 *
1011 * @hide
1012 */
1013 public static final int PRIVATE_FLAG_SET_NEEDS_MENU_KEY = 0x00000008;
1014
Craig Mautner88400d32012-09-30 12:35:45 -07001015 /** In a multiuser system if this flag is set and the owner is a system process then this
1016 * window will appear on all user screens. This overrides the default behavior of window
1017 * types that normally only appear on the owning user's screen. Refer to each window type
1018 * to determine its default behavior.
1019 *
1020 * {@hide} */
1021 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1022
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001023 /**
Dianne Hackborn891d3fb2013-01-09 18:31:37 -08001024 * Special flag for the volume overlay: force the window manager out of "hide nav bar"
1025 * mode while the window is on screen.
1026 *
1027 * {@hide} */
1028 public static final int PRIVATE_FLAG_FORCE_SHOW_NAV_BAR = 0x00000020;
1029
1030 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001031 * Never animate position changes of the window.
1032 *
1033 * {@hide} */
1034 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1035
Adam Lesinski6a591f52013-10-01 18:11:17 -07001036 /** Window flag: special flag to limit the size of the window to be
1037 * original size ([320x480] x density). Used to create window for applications
1038 * running under compatibility mode.
1039 *
1040 * {@hide} */
1041 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1042
1043 /** Window flag: a special option intended for system dialogs. When
1044 * this flag is set, the window will demand focus unconditionally when
1045 * it is created.
1046 * {@hide} */
1047 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1048
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001049 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001050 * Control flags that are private to the platform.
1051 * @hide
1052 */
1053 public int privateFlags;
1054
1055 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001056 * Given a particular set of window manager flags, determine whether
1057 * such a window may be a target for an input method when it has
1058 * focus. In particular, this checks the
1059 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1060 * flags and returns true if the combination of the two corresponds
1061 * to a window that needs to be behind the input method so that the
1062 * user can type into it.
1063 *
1064 * @param flags The current window manager flags.
1065 *
1066 * @return Returns true if such a window should be behind/interact
1067 * with an input method, false if not.
1068 */
1069 public static boolean mayUseInputMethod(int flags) {
1070 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
1071 case 0:
1072 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
1073 return true;
1074 }
1075 return false;
1076 }
1077
1078 /**
1079 * Mask for {@link #softInputMode} of the bits that determine the
1080 * desired visibility state of the soft input area for this window.
1081 */
1082 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
1083
1084 /**
1085 * Visibility state for {@link #softInputMode}: no state has been specified.
1086 */
1087 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
1088
1089 /**
1090 * Visibility state for {@link #softInputMode}: please don't change the state of
1091 * the soft input area.
1092 */
1093 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
1094
1095 /**
1096 * Visibility state for {@link #softInputMode}: please hide any soft input
1097 * area when normally appropriate (when the user is navigating
1098 * forward to your window).
1099 */
1100 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
1101
1102 /**
1103 * Visibility state for {@link #softInputMode}: please always hide any
1104 * soft input area when this window receives focus.
1105 */
1106 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
1107
1108 /**
1109 * Visibility state for {@link #softInputMode}: please show the soft
1110 * input area when normally appropriate (when the user is navigating
1111 * forward to your window).
1112 */
1113 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
1114
1115 /**
1116 * Visibility state for {@link #softInputMode}: please always make the
1117 * soft input area visible when this window receives input focus.
1118 */
1119 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
1120
1121 /**
1122 * Mask for {@link #softInputMode} of the bits that determine the
1123 * way that the window should be adjusted to accommodate the soft
1124 * input window.
1125 */
1126 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
1127
1128 /** Adjustment option for {@link #softInputMode}: nothing specified.
1129 * The system will try to pick one or
1130 * the other depending on the contents of the window.
1131 */
1132 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
1133
1134 /** Adjustment option for {@link #softInputMode}: set to allow the
1135 * window to be resized when an input
1136 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07001137 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 * {@link #SOFT_INPUT_ADJUST_PAN}; if
1139 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07001140 * the other depending on the contents of the window. If the window's
1141 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
1142 * value for {@link #softInputMode} will be ignored; the window will
1143 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001144 */
1145 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
1146
1147 /** Adjustment option for {@link #softInputMode}: set to have a window
1148 * pan when an input method is
1149 * shown, so it doesn't need to deal with resizing but just panned
1150 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07001151 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 * neither of these are set, then the system will try to pick one or
1153 * the other depending on the contents of the window.
1154 */
1155 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
1156
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001157 /** Adjustment option for {@link #softInputMode}: set to have a window
1158 * not adjust for a shown input method. The window will not be resized,
1159 * and it will not be panned to make its focus visible.
1160 */
1161 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
1162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001163 /**
1164 * Bit for {@link #softInputMode}: set when the user has navigated
1165 * forward to the window. This is normally set automatically for
1166 * you by the system, though you may want to set it in certain cases
1167 * when you are displaying a window yourself. This flag will always
1168 * be cleared automatically after the window is displayed.
1169 */
1170 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001171
1172 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08001173 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001174 * of:
1175 *
1176 * <ul>
1177 * <li> One of the visibility states
1178 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
1179 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or
1180 * {@link #SOFT_INPUT_STATE_VISIBLE}.
1181 * <li> One of the adjustment options
1182 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},
1183 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or
1184 * {@link #SOFT_INPUT_ADJUST_PAN}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001185 * </ul>
1186 *
1187 *
1188 * <p>This flag can be controlled in your theme through the
1189 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001190 */
1191 public int softInputMode;
1192
1193 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001194 * Placement of window within the screen as per {@link Gravity}. Both
1195 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1196 * android.graphics.Rect) Gravity.apply} and
1197 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1198 * Gravity.applyDisplay} are used during window layout, with this value
1199 * given as the desired gravity. For example you can specify
1200 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
1201 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
1202 * to control the behavior of
1203 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1204 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001205 *
1206 * @see Gravity
1207 */
1208 public int gravity;
1209
1210 /**
1211 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001212 * between the container and the widget. See
1213 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1214 * android.graphics.Rect) Gravity.apply} for how this is used. This
1215 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 */
1217 public float horizontalMargin;
1218
1219 /**
1220 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001221 * between the container and the widget. See
1222 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1223 * android.graphics.Rect) Gravity.apply} for how this is used. This
1224 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001225 */
1226 public float verticalMargin;
1227
1228 /**
1229 * The desired bitmap format. May be one of the constants in
1230 * {@link android.graphics.PixelFormat}. Default is OPAQUE.
1231 */
1232 public int format;
1233
1234 /**
1235 * A style resource defining the animations to use for this window.
1236 * This must be a system resource; it can not be an application resource
1237 * because the window manager does not have access to applications.
1238 */
1239 public int windowAnimations;
1240
1241 /**
1242 * An alpha value to apply to this entire window.
1243 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1244 */
1245 public float alpha = 1.0f;
1246
1247 /**
1248 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1249 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1250 * dim.
1251 */
1252 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001253
1254 /**
1255 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1256 * indicating that the brightness value is not overridden for this window
1257 * and normal brightness policy should be used.
1258 */
1259 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1260
1261 /**
1262 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1263 * indicating that the screen or button backlight brightness should be set
1264 * to the lowest value when this window is in front.
1265 */
1266 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1267
1268 /**
1269 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1270 * indicating that the screen or button backlight brightness should be set
1271 * to the hightest value when this window is in front.
1272 */
1273 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274
1275 /**
1276 * This can be used to override the user's preferred brightness of
1277 * the screen. A value of less than 0, the default, means to use the
1278 * preferred screen brightness. 0 to 1 adjusts the brightness from
1279 * dark to full bright.
1280 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001281 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001282
1283 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001284 * This can be used to override the standard behavior of the button and
1285 * keyboard backlights. A value of less than 0, the default, means to
1286 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1287 * from dark to full bright.
1288 */
1289 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1290
1291 /**
Craig Mautner3c174372013-02-21 17:54:37 -08001292 * Value for {@link #rotationAnimation} to define the animation used to
1293 * specify that this window will rotate in or out following a rotation.
1294 */
1295 public static final int ROTATION_ANIMATION_ROTATE = 0;
1296
1297 /**
1298 * Value for {@link #rotationAnimation} to define the animation used to
1299 * specify that this window will fade in or out following a rotation.
1300 */
1301 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
1302
1303 /**
1304 * Value for {@link #rotationAnimation} to define the animation used to
1305 * specify that this window will immediately disappear or appear following
1306 * a rotation.
1307 */
1308 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
1309
1310 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001311 * Define the exit and entry animations used on this window when the device is rotated.
1312 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08001313 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001314 * by other windows. All other situations default to the
1315 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
Craig Mautner3c174372013-02-21 17:54:37 -08001316 *
1317 * @see #ROTATION_ANIMATION_ROTATE
1318 * @see #ROTATION_ANIMATION_CROSSFADE
1319 * @see #ROTATION_ANIMATION_JUMPCUT
1320 */
1321 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
1322
1323 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001324 * Identifier for this window. This will usually be filled in for
1325 * you.
1326 */
1327 public IBinder token = null;
1328
1329 /**
1330 * Name of the package owning this window.
1331 */
1332 public String packageName = null;
1333
1334 /**
1335 * Specific orientation value for a window.
1336 * May be any of the same values allowed
1337 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1338 * If not set, a default value of
1339 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
1340 * will be used.
1341 */
1342 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001343
1344 /**
1345 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001346 *
1347 * @see View#STATUS_BAR_VISIBLE
1348 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001349 */
1350 public int systemUiVisibility;
1351
1352 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001353 * @hide
1354 * The ui visibility as requested by the views in this hierarchy.
1355 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1356 */
1357 public int subtreeSystemUiVisibility;
1358
1359 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001360 * Get callbacks about the system ui visibility changing.
1361 *
1362 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1363 *
1364 * @hide
1365 */
1366 public boolean hasSystemUiListeners;
1367
Jeff Brown474dcb52011-06-14 20:22:50 -07001368 /**
1369 * When this window has focus, disable touch pad pointer gesture processing.
1370 * The window will receive raw position updates from the touch pad instead
1371 * of pointer movements and synthetic touch events.
1372 *
1373 * @hide
1374 */
1375 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1376
1377 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001378 * Does not construct an input channel for this window. The channel will therefore
1379 * be incapable of receiving input.
1380 *
1381 * @hide
1382 */
1383 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1384
1385 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001386 * When this window has focus, does not call user activity for all input events so
1387 * the application will have to do it itself. Should only be used by
1388 * the keyguard and phone app.
1389 * <p>
1390 * Should only be used by the keyguard and phone app.
1391 * </p>
1392 *
1393 * @hide
1394 */
1395 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
1396
1397 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001398 * Control special features of the input subsystem.
1399 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001400 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001401 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001402 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07001403 * @hide
1404 */
1405 public int inputFeatures;
1406
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001407 /**
1408 * Sets the number of milliseconds before the user activity timeout occurs
1409 * when this window has focus. A value of -1 uses the standard timeout.
1410 * A value of 0 uses the minimum support display timeout.
1411 * <p>
1412 * This property can only be used to reduce the user specified display timeout;
1413 * it can never make the timeout longer than it normally would be.
1414 * </p><p>
1415 * Should only be used by the keyguard and phone app.
1416 * </p>
1417 *
1418 * @hide
1419 */
1420 public long userActivityTimeout = -1;
1421
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001423 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001424 type = TYPE_APPLICATION;
1425 format = PixelFormat.OPAQUE;
1426 }
1427
1428 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001429 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001430 type = _type;
1431 format = PixelFormat.OPAQUE;
1432 }
1433
1434 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001435 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001436 type = _type;
1437 flags = _flags;
1438 format = PixelFormat.OPAQUE;
1439 }
1440
1441 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08001442 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001443 type = _type;
1444 flags = _flags;
1445 format = _format;
1446 }
1447
1448 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
1449 super(w, h);
1450 type = _type;
1451 flags = _flags;
1452 format = _format;
1453 }
1454
1455 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
1456 int _flags, int _format) {
1457 super(w, h);
1458 x = xpos;
1459 y = ypos;
1460 type = _type;
1461 flags = _flags;
1462 format = _format;
1463 }
1464
1465 public final void setTitle(CharSequence title) {
1466 if (null == title)
1467 title = "";
1468
1469 mTitle = TextUtils.stringOrSpannedString(title);
1470 }
1471
1472 public final CharSequence getTitle() {
1473 return mTitle;
1474 }
1475
1476 public int describeContents() {
1477 return 0;
1478 }
1479
1480 public void writeToParcel(Parcel out, int parcelableFlags) {
1481 out.writeInt(width);
1482 out.writeInt(height);
1483 out.writeInt(x);
1484 out.writeInt(y);
1485 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001486 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001487 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001488 out.writeInt(softInputMode);
1489 out.writeInt(gravity);
1490 out.writeFloat(horizontalMargin);
1491 out.writeFloat(verticalMargin);
1492 out.writeInt(format);
1493 out.writeInt(windowAnimations);
1494 out.writeFloat(alpha);
1495 out.writeFloat(dimAmount);
1496 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001497 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08001498 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001499 out.writeStrongBinder(token);
1500 out.writeString(packageName);
1501 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
1502 out.writeInt(screenOrientation);
Joe Onorato664644d2011-01-23 17:53:23 -08001503 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08001504 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08001505 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07001506 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001507 out.writeLong(userActivityTimeout);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001508 }
1509
1510 public static final Parcelable.Creator<LayoutParams> CREATOR
1511 = new Parcelable.Creator<LayoutParams>() {
1512 public LayoutParams createFromParcel(Parcel in) {
1513 return new LayoutParams(in);
1514 }
1515
1516 public LayoutParams[] newArray(int size) {
1517 return new LayoutParams[size];
1518 }
1519 };
1520
1521
1522 public LayoutParams(Parcel in) {
1523 width = in.readInt();
1524 height = in.readInt();
1525 x = in.readInt();
1526 y = in.readInt();
1527 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001528 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001529 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001530 softInputMode = in.readInt();
1531 gravity = in.readInt();
1532 horizontalMargin = in.readFloat();
1533 verticalMargin = in.readFloat();
1534 format = in.readInt();
1535 windowAnimations = in.readInt();
1536 alpha = in.readFloat();
1537 dimAmount = in.readFloat();
1538 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001539 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08001540 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001541 token = in.readStrongBinder();
1542 packageName = in.readString();
1543 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
1544 screenOrientation = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001545 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08001546 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001547 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07001548 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001549 userActivityTimeout = in.readLong();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001550 }
1551
Romain Guy72998072009-06-22 11:09:20 -07001552 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001553 public static final int LAYOUT_CHANGED = 1<<0;
1554 public static final int TYPE_CHANGED = 1<<1;
1555 public static final int FLAGS_CHANGED = 1<<2;
1556 public static final int FORMAT_CHANGED = 1<<3;
1557 public static final int ANIMATION_CHANGED = 1<<4;
1558 public static final int DIM_AMOUNT_CHANGED = 1<<5;
1559 public static final int TITLE_CHANGED = 1<<6;
1560 public static final int ALPHA_CHANGED = 1<<7;
1561 public static final int MEMORY_TYPE_CHANGED = 1<<8;
1562 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
1563 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
1564 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08001565 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001566 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001567 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08001568 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001569 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08001570 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001571 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07001572 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001573 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001574 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001575 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07001576 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001577 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001578 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07001579 public static final int EVERYTHING_CHANGED = 0xffffffff;
1580
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001581 // internal buffer to backup/restore parameters under compatibility mode.
1582 private int[] mCompatibilityParamsBackup = null;
1583
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001584 public final int copyFrom(LayoutParams o) {
1585 int changes = 0;
1586
1587 if (width != o.width) {
1588 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07001589 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001590 }
1591 if (height != o.height) {
1592 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07001593 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001594 }
1595 if (x != o.x) {
1596 x = o.x;
1597 changes |= LAYOUT_CHANGED;
1598 }
1599 if (y != o.y) {
1600 y = o.y;
1601 changes |= LAYOUT_CHANGED;
1602 }
1603 if (horizontalWeight != o.horizontalWeight) {
1604 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001605 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001606 }
1607 if (verticalWeight != o.verticalWeight) {
1608 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001609 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001610 }
1611 if (horizontalMargin != o.horizontalMargin) {
1612 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001613 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001614 }
1615 if (verticalMargin != o.verticalMargin) {
1616 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001617 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001618 }
1619 if (type != o.type) {
1620 type = o.type;
1621 changes |= TYPE_CHANGED;
1622 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001623 if (flags != o.flags) {
1624 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07001625 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001626 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001627 if (privateFlags != o.privateFlags) {
1628 privateFlags = o.privateFlags;
1629 changes |= PRIVATE_FLAGS_CHANGED;
1630 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001631 if (softInputMode != o.softInputMode) {
1632 softInputMode = o.softInputMode;
1633 changes |= SOFT_INPUT_MODE_CHANGED;
1634 }
1635 if (gravity != o.gravity) {
1636 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07001637 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001638 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001639 if (format != o.format) {
1640 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07001641 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001642 }
1643 if (windowAnimations != o.windowAnimations) {
1644 windowAnimations = o.windowAnimations;
1645 changes |= ANIMATION_CHANGED;
1646 }
1647 if (token == null) {
1648 // NOTE: token only copied if the recipient doesn't
1649 // already have one.
1650 token = o.token;
1651 }
1652 if (packageName == null) {
1653 // NOTE: packageName only copied if the recipient doesn't
1654 // already have one.
1655 packageName = o.packageName;
1656 }
1657 if (!mTitle.equals(o.mTitle)) {
1658 mTitle = o.mTitle;
1659 changes |= TITLE_CHANGED;
1660 }
1661 if (alpha != o.alpha) {
1662 alpha = o.alpha;
1663 changes |= ALPHA_CHANGED;
1664 }
1665 if (dimAmount != o.dimAmount) {
1666 dimAmount = o.dimAmount;
1667 changes |= DIM_AMOUNT_CHANGED;
1668 }
1669 if (screenBrightness != o.screenBrightness) {
1670 screenBrightness = o.screenBrightness;
1671 changes |= SCREEN_BRIGHTNESS_CHANGED;
1672 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001673 if (buttonBrightness != o.buttonBrightness) {
1674 buttonBrightness = o.buttonBrightness;
1675 changes |= BUTTON_BRIGHTNESS_CHANGED;
1676 }
Craig Mautner3c174372013-02-21 17:54:37 -08001677 if (rotationAnimation != o.rotationAnimation) {
1678 rotationAnimation = o.rotationAnimation;
1679 changes |= ROTATION_ANIMATION_CHANGED;
1680 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001681
1682 if (screenOrientation != o.screenOrientation) {
1683 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07001684 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001685 }
Romain Guy529b60a2010-08-03 18:05:47 -07001686
Joe Onorato14782f72011-01-25 19:53:17 -08001687 if (systemUiVisibility != o.systemUiVisibility
1688 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08001689 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08001690 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08001691 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
1692 }
1693
1694 if (hasSystemUiListeners != o.hasSystemUiListeners) {
1695 hasSystemUiListeners = o.hasSystemUiListeners;
1696 changes |= SYSTEM_UI_LISTENER_CHANGED;
1697 }
1698
Jeff Brown474dcb52011-06-14 20:22:50 -07001699 if (inputFeatures != o.inputFeatures) {
1700 inputFeatures = o.inputFeatures;
1701 changes |= INPUT_FEATURES_CHANGED;
1702 }
1703
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001704 if (userActivityTimeout != o.userActivityTimeout) {
1705 userActivityTimeout = o.userActivityTimeout;
1706 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
1707 }
1708
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001709 return changes;
1710 }
1711
1712 @Override
1713 public String debug(String output) {
1714 output += "Contents of " + this + ":";
1715 Log.d("Debug", output);
1716 output = super.debug("");
1717 Log.d("Debug", output);
1718 Log.d("Debug", "");
1719 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
1720 return "";
1721 }
1722
1723 @Override
1724 public String toString() {
1725 StringBuilder sb = new StringBuilder(256);
1726 sb.append("WM.LayoutParams{");
1727 sb.append("(");
1728 sb.append(x);
1729 sb.append(',');
1730 sb.append(y);
1731 sb.append(")(");
Romain Guy980a9382010-01-08 15:06:28 -08001732 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001733 sb.append('x');
Romain Guy980a9382010-01-08 15:06:28 -08001734 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001735 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001736 if (horizontalMargin != 0) {
1737 sb.append(" hm=");
1738 sb.append(horizontalMargin);
1739 }
1740 if (verticalMargin != 0) {
1741 sb.append(" vm=");
1742 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001743 }
1744 if (gravity != 0) {
1745 sb.append(" gr=#");
1746 sb.append(Integer.toHexString(gravity));
1747 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001748 if (softInputMode != 0) {
1749 sb.append(" sim=#");
1750 sb.append(Integer.toHexString(softInputMode));
1751 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001752 sb.append(" ty=");
1753 sb.append(type);
1754 sb.append(" fl=#");
1755 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001756 if (privateFlags != 0) {
1757 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
1758 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001759 if (format != PixelFormat.OPAQUE) {
1760 sb.append(" fmt=");
1761 sb.append(format);
1762 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001763 if (windowAnimations != 0) {
1764 sb.append(" wanim=0x");
1765 sb.append(Integer.toHexString(windowAnimations));
1766 }
1767 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
1768 sb.append(" or=");
1769 sb.append(screenOrientation);
1770 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001771 if (alpha != 1.0f) {
1772 sb.append(" alpha=");
1773 sb.append(alpha);
1774 }
1775 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1776 sb.append(" sbrt=");
1777 sb.append(screenBrightness);
1778 }
1779 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1780 sb.append(" bbrt=");
1781 sb.append(buttonBrightness);
1782 }
Craig Mautner3c174372013-02-21 17:54:37 -08001783 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
1784 sb.append(" rotAnim=");
1785 sb.append(rotationAnimation);
1786 }
Adam Lesinski6a591f52013-10-01 18:11:17 -07001787 if ((flags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
Mitsuru Oshima5a2b91d2009-07-16 16:30:02 -07001788 sb.append(" compatible=true");
1789 }
Joe Onorato664644d2011-01-23 17:53:23 -08001790 if (systemUiVisibility != 0) {
1791 sb.append(" sysui=0x");
1792 sb.append(Integer.toHexString(systemUiVisibility));
1793 }
Joe Onorato14782f72011-01-25 19:53:17 -08001794 if (subtreeSystemUiVisibility != 0) {
1795 sb.append(" vsysui=0x");
1796 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
1797 }
Joe Onorato664644d2011-01-23 17:53:23 -08001798 if (hasSystemUiListeners) {
1799 sb.append(" sysuil=");
1800 sb.append(hasSystemUiListeners);
1801 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001802 if (inputFeatures != 0) {
1803 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
1804 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001805 if (userActivityTimeout >= 0) {
1806 sb.append(" userActivityTimeout=").append(userActivityTimeout);
1807 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001808 sb.append('}');
1809 return sb.toString();
1810 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001811
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001812 /**
1813 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001814 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001815 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001816 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001817 x = (int) (x * scale + 0.5f);
1818 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001819 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001820 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001821 }
1822 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001823 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001824 }
1825 }
1826
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001827 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001828 * Backup the layout parameters used in compatibility mode.
1829 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001830 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001831 void backup() {
1832 int[] backup = mCompatibilityParamsBackup;
1833 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001834 // we backup 4 elements, x, y, width, height
1835 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001836 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001837 backup[0] = x;
1838 backup[1] = y;
1839 backup[2] = width;
1840 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001841 }
1842
1843 /**
1844 * Restore the layout params' coordinates, size and gravity
1845 * @see LayoutParams#backup()
1846 */
1847 void restore() {
1848 int[] backup = mCompatibilityParamsBackup;
1849 if (backup != null) {
1850 x = backup[0];
1851 y = backup[1];
1852 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001853 height = backup[3];
1854 }
1855 }
1856
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001857 private CharSequence mTitle = "";
1858 }
1859}