blob: 4c97414ddf90eeda442477d7ebc8dcc98c2110c6 [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 /**
Jeff Browna492c3a2012-08-23 19:48:44 -070065 * Returns the {@link Display} upon which this {@link WindowManager} instance
66 * will create new windows.
67 * <p>
68 * Despite the name of this method, the display that is returned is not
69 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
70 * The returned display could instead be a secondary display that this
71 * window manager instance is managing. Think of it as the display that
72 * this {@link WindowManager} instance uses by default.
73 * </p><p>
74 * To create windows on a different display, you need to obtain a
75 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
76 * class documentation for more information.)
77 * </p>
78 *
79 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 */
81 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -070082
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 /**
84 * Special variation of {@link #removeView} that immediately invokes
85 * the given view hierarchy's {@link View#onDetachedFromWindow()
86 * View.onDetachedFromWindow()} methods before returning. This is not
87 * for normal applications; using it correctly requires great care.
88 *
89 * @param view The view to be removed.
90 */
91 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -070092
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 public static class LayoutParams extends ViewGroup.LayoutParams
94 implements Parcelable {
95 /**
96 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -070097 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
98 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 */
Romain Guy529b60a2010-08-03 18:05:47 -0700100 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 public int x;
102
103 /**
104 * Y position for this window. With the default gravity it is ignored.
105 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
106 * an offset from the given edge.
107 */
Romain Guy529b60a2010-08-03 18:05:47 -0700108 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 public int y;
110
111 /**
112 * Indicates how much of the extra space will be allocated horizontally
113 * to the view associated with these LayoutParams. Specify 0 if the view
114 * should not be stretched. Otherwise the extra pixels will be pro-rated
115 * among all views whose weight is greater than 0.
116 */
Romain Guy529b60a2010-08-03 18:05:47 -0700117 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 public float horizontalWeight;
119
120 /**
121 * Indicates how much of the extra space will be allocated vertically
122 * to the view associated with these LayoutParams. Specify 0 if the view
123 * should not be stretched. Otherwise the extra pixels will be pro-rated
124 * among all views whose weight is greater than 0.
125 */
Romain Guy529b60a2010-08-03 18:05:47 -0700126 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700128
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 /**
130 * The general type of window. There are three main classes of
131 * window types:
132 * <ul>
133 * <li> <strong>Application windows</strong> (ranging from
134 * {@link #FIRST_APPLICATION_WINDOW} to
135 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
136 * windows. For these types of windows, the {@link #token} must be
137 * set to the token of the activity they are a part of (this will
138 * normally be done for you if {@link #token} is null).
139 * <li> <strong>Sub-windows</strong> (ranging from
140 * {@link #FIRST_SUB_WINDOW} to
141 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
142 * window. For these types of windows, the {@link #token} must be
143 * the token of the window it is attached to.
144 * <li> <strong>System windows</strong> (ranging from
145 * {@link #FIRST_SYSTEM_WINDOW} to
146 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
147 * use by the system for specific purposes. They should not normally
148 * be used by applications, and a special permission is required
149 * to use them.
150 * </ul>
151 *
152 * @see #TYPE_BASE_APPLICATION
153 * @see #TYPE_APPLICATION
154 * @see #TYPE_APPLICATION_STARTING
155 * @see #TYPE_APPLICATION_PANEL
156 * @see #TYPE_APPLICATION_MEDIA
157 * @see #TYPE_APPLICATION_SUB_PANEL
158 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
159 * @see #TYPE_STATUS_BAR
160 * @see #TYPE_SEARCH_BAR
161 * @see #TYPE_PHONE
162 * @see #TYPE_SYSTEM_ALERT
163 * @see #TYPE_KEYGUARD
164 * @see #TYPE_TOAST
165 * @see #TYPE_SYSTEM_OVERLAY
166 * @see #TYPE_PRIORITY_PHONE
167 * @see #TYPE_STATUS_BAR_PANEL
168 * @see #TYPE_SYSTEM_DIALOG
169 * @see #TYPE_KEYGUARD_DIALOG
170 * @see #TYPE_SYSTEM_ERROR
171 * @see #TYPE_INPUT_METHOD
172 * @see #TYPE_INPUT_METHOD_DIALOG
173 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700174 @ViewDebug.ExportedProperty(mapping = {
175 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
176 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
177 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
178 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
179 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
180 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
181 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700182 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700183 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
184 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
185 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
186 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
187 @ViewDebug.IntToString(from = TYPE_KEYGUARD, to = "TYPE_KEYGUARD"),
188 @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
189 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
190 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700191 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"),
192 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
193 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
194 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
Jeff Brown3b2b3542010-10-15 00:54:27 -0700195 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700196 @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
197 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700198 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700199 @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
200 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
201 @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
202 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
203 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700204 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
205 @ViewDebug.IntToString(from = TYPE_HIDDEN_NAV_CONSUMER, to = "TYPE_HIDDEN_NAV_CONSUMER"),
206 @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
Jeff Brownbd6e1502012-08-28 03:27:37 -0700207 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"),
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700208 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"),
209 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700210 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800211 public int type;
212
213 /**
214 * Start of window types that represent normal application windows.
215 */
216 public static final int FIRST_APPLICATION_WINDOW = 1;
217
218 /**
219 * Window type: an application window that serves as the "base" window
220 * of the overall application; all other application windows will
221 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700222 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800223 */
224 public static final int TYPE_BASE_APPLICATION = 1;
225
226 /**
227 * Window type: a normal application window. The {@link #token} must be
228 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700229 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800230 */
231 public static final int TYPE_APPLICATION = 2;
232
233 /**
234 * Window type: special application window that is displayed while the
235 * application is starting. Not for use by applications themselves;
236 * this is used by the system to display something until the
237 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700238 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239 */
240 public static final int TYPE_APPLICATION_STARTING = 3;
241
242 /**
243 * End of types of application windows.
244 */
245 public static final int LAST_APPLICATION_WINDOW = 99;
246
247 /**
248 * Start of types of sub-windows. The {@link #token} of these windows
249 * must be set to the window they are attached to. These types of
250 * windows are kept next to their attached window in Z-order, and their
251 * coordinate space is relative to their attached window.
252 */
253 public static final int FIRST_SUB_WINDOW = 1000;
254
255 /**
256 * Window type: a panel on top of an application window. These windows
257 * appear on top of their attached window.
258 */
259 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
260
261 /**
262 * Window type: window for showing media (e.g. video). These windows
263 * are displayed behind their attached window.
264 */
265 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1;
266
267 /**
268 * Window type: a sub-panel on top of an application window. These
269 * windows are displayed on top their attached window and any
270 * {@link #TYPE_APPLICATION_PANEL} panels.
271 */
272 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW+2;
273
274 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
275 * of the window happens as that of a top-level window, <em>not</em>
276 * as a child of its container.
277 */
278 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3;
279
280 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700281 * Window type: window for showing overlays on top of media windows.
282 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
283 * application window. They should be translucent to be useful. This
284 * is a big ugly hack so:
285 * @hide
286 */
287 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4;
288
289 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800290 * End of types of sub-windows.
291 */
292 public static final int LAST_SUB_WINDOW = 1999;
293
294 /**
295 * Start of system-specific window types. These are not normally
296 * created by applications.
297 */
298 public static final int FIRST_SYSTEM_WINDOW = 2000;
299
300 /**
301 * Window type: the status bar. There can be only one status bar
302 * window; it is placed at the top of the screen, and all other
303 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700304 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800305 */
306 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
307
308 /**
309 * Window type: the search bar. There can be only one search bar
310 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700311 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800312 */
313 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
314
315 /**
316 * Window type: phone. These are non-application windows providing
317 * user interaction with the phone (in particular incoming calls).
318 * These windows are normally placed above all applications, but behind
319 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700320 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800321 */
322 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
323
324 /**
325 * Window type: system window, such as low power alert. These windows
326 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700327 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800328 */
329 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
330
331 /**
332 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700333 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800334 */
335 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
336
337 /**
338 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700339 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800340 */
341 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
342
343 /**
344 * Window type: system overlay windows, which need to be displayed
345 * on top of everything else. These windows must not take input
346 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700347 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800348 */
349 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
350
351 /**
352 * Window type: priority phone UI, which needs to be displayed even if
353 * the keyguard is active. These windows must not take input
354 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700355 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800356 */
357 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
358
359 /**
360 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700361 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800362 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
364
365 /**
366 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700367 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800368 */
369 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
370
371 /**
372 * Window type: internal system error windows, appear on top of
373 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700374 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800375 */
376 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
377
378 /**
379 * Window type: internal input methods windows, which appear above
380 * the normal UI. Application windows may be resized or panned to keep
381 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700382 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800383 */
384 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
385
386 /**
387 * Window type: internal input methods dialog windows, which appear above
388 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700389 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 */
391 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
392
393 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700394 * Window type: wallpaper window, placed behind any window that wants
395 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700396 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700397 */
398 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
399
400 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800401 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700402 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800403 */
404 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700405
406 /**
407 * Window type: secure system overlay windows, which need to be displayed
408 * on top of everything else. These windows must not take input
409 * focus, or they will interfere with the keyguard.
410 *
411 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
412 * system itself is allowed to create these overlays. Applications cannot
413 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700414 *
415 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700416 * @hide
417 */
418 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
419
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800420 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700421 * Window type: the drag-and-drop pseudowindow. There is only one
422 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700423 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700424 * @hide
425 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700426 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700427
428 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800429 * Window type: panel that slides out from under the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700430 * In multiuser systems shows on all users' windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800431 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800432 */
433 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
434
Jeff Brown83c09682010-12-23 17:50:18 -0800435 /**
436 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700437 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800438 * @hide
439 */
440 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800441
442 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400443 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700444 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400445 * @hide
446 */
447 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
448
449 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700450 * Window type: The volume level overlay/dialog shown when the user
451 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700452 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700453 * @hide
454 */
455 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
456
457 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700458 * Window type: The boot progress dialog, goes on top of everything
459 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700460 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700461 * @hide
462 */
463 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
464
465 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700466 * Window type: Fake window to consume touch events when the navigation
467 * bar is hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700468 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700469 * @hide
470 */
471 public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22;
472
473 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500474 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700475 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500476 * @hide
477 */
478 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
479
480 /**
Jim Millere898ac52012-04-06 17:10:57 -0700481 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700482 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700483 * @hide
484 */
485 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
486
487 /**
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700488 * Window type: Behind the universe of the real windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700489 * In multiuser systems shows on all users' windows.
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700490 * @hide
491 */
492 public static final int TYPE_UNIVERSE_BACKGROUND = FIRST_SYSTEM_WINDOW+25;
493
494 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700495 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700496 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700497 * @hide
498 */
499 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
500
501 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700502 * Window type: Magnification overlay window. Used to highlight the magnified
503 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -0700504 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700505 * @hide
506 */
507 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
508
509 /**
Craig Mautner88400d32012-09-30 12:35:45 -0700510 * Window type: Recents. Same layer as {@link #TYPE_SYSTEM_DIALOG} but only appears on
511 * one user's screen.
512 * In multiuser systems shows on all users' windows.
513 * @hide
514 */
515 public static final int TYPE_RECENTS_OVERLAY = FIRST_SYSTEM_WINDOW+28;
516
517 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800518 * End of types of system windows.
519 */
520 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800521
Mathias Agopiand2112302010-12-07 19:38:17 -0800522 /** @deprecated this is ignored, this value is set automatically when needed. */
523 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800525 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700526 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800527 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800528 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700529 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800530 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800531 /** @deprecated this is ignored, this value is set automatically when needed. */
532 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800533 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700534
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800535 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700536 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700538 @Deprecated
539 public int memoryType;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540
Mike Lockwoodef731622010-01-27 17:51:34 -0500541 /** Window flag: as long as this window is visible to the user, allow
542 * the lock screen to activate while the screen is on.
543 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800544 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500545 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
546
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800547 /** Window flag: everything behind this window will be dimmed.
548 * Use {@link #dimAmount} to control the amount of dim. */
549 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700550
551 /** Window flag: blur everything behind this window.
552 * @deprecated Blurring is no longer supported. */
553 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700555
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800556 /** Window flag: this window won't ever get key input focus, so the
557 * user can not send key or other button events to it. Those will
558 * instead go to whatever focusable window is behind it. This flag
559 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
560 * is explicitly set.
561 *
562 * <p>Setting this flag also implies that the window will not need to
563 * interact with
564 * a soft input method, so it will be Z-ordered and positioned
565 * independently of any active input method (typically this means it
566 * gets Z-ordered on top of the input method, so it can use the full
567 * screen for its content and cover the input method if needed. You
568 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
569 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
570
571 /** Window flag: this window can never receive touch events. */
572 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
573
574 /** Window flag: Even when this window is focusable (its
575 * {@link #FLAG_NOT_FOCUSABLE is not set), allow any pointer events
576 * outside of the window to be sent to the windows behind it. Otherwise
577 * it will consume all pointer events itself, regardless of whether they
578 * are inside of the window. */
579 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
580
581 /** Window flag: When set, if the device is asleep when the touch
582 * screen is pressed, you will receive this first touch event. Usually
583 * the first touch event is consumed by the system since the user can
584 * not see what they are pressing on.
585 */
586 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
587
588 /** Window flag: as long as this window is visible to the user, keep
589 * the device's screen turned on and bright. */
590 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
591
592 /** Window flag: place the window within the entire screen, ignoring
593 * decorations around the border (a.k.a. the status bar). The
594 * window must correctly position its contents to take the screen
595 * decoration into account. This flag is normally set for you
596 * by Window as described in {@link Window#setFlags}. */
597 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
598
599 /** Window flag: allow window to extend outside of the screen. */
600 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
601
602 /** Window flag: Hide all screen decorations (e.g. status bar) while
603 * this window is displayed. This allows the window to use the entire
604 * display space for itself -- the status bar will be hidden when
605 * an app window with this flag set is on the top layer. */
606 public static final int FLAG_FULLSCREEN = 0x00000400;
607
608 /** Window flag: Override {@link #FLAG_FULLSCREEN and force the
609 * screen decorations (such as status bar) to be shown. */
610 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
611
612 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700613 * the screen.
614 * @deprecated This flag is no longer used. */
615 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800616 public static final int FLAG_DITHER = 0x00001000;
617
618 /** Window flag: don't allow screen shots while this window is
Glenn Kastend6f5bde2011-01-19 15:27:27 -0800619 * displayed. Maps to Surface.SECURE. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800620 public static final int FLAG_SECURE = 0x00002000;
621
622 /** Window flag: a special mode where the layout parameters are used
623 * to perform scaling of the surface when it is composited to the
624 * screen. */
625 public static final int FLAG_SCALED = 0x00004000;
626
627 /** Window flag: intended for windows that will often be used when the user is
628 * holding the screen against their face, it will aggressively filter the event
629 * stream to prevent unintended presses in this situation that may not be
630 * desired for a particular window, when such an event stream is detected, the
631 * application will receive a CANCEL motion event to indicate this so applications
632 * can handle this accordingly by taking no action on the event
633 * until the finger is released. */
634 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
635
636 /** Window flag: a special option only for use in combination with
637 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
638 * screen your window may appear on top of or behind screen decorations
639 * such as the status bar. By also including this flag, the window
640 * manager will report the inset rectangle needed to ensure your
641 * content is not covered by screen decorations. This flag is normally
642 * set for you by Window as described in {@link Window#setFlags}.*/
643 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
644
645 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
646 * respect to how this window interacts with the current method. That
647 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
648 * window will behave as if it needs to interact with the input method
649 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
650 * not set and this flag is set, then the window will behave as if it
651 * doesn't need to interact with the input method and can be placed
652 * to use more space and cover the input method.
653 */
654 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
655
656 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
657 * can set this flag to receive a single special MotionEvent with
658 * the action
659 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
660 * touches that occur outside of your window. Note that you will not
661 * receive the full down/move/up gesture, only the location of the
662 * first down as an ACTION_OUTSIDE.
663 */
664 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
665
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700666 /** Window flag: special flag to let windows be shown when the screen
667 * is locked. This will let application windows take precedence over
668 * key guard or any other lock screens. Can be used with
669 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700670 * directly before showing the key guard window. Can be used with
671 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
672 * non-secure keyguards. This flag only applies to the top-most
673 * full-screen window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700674 */
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700675 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
676
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700677 /** Window flag: ask that the system wallpaper be shown behind
678 * your window. The window surface must be translucent to be able
679 * to actually see the wallpaper behind it; this flag just ensures
680 * that the wallpaper surface will be there if this window actually
681 * has translucent regions.
682 */
683 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
684
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700685 /** Window flag: when set as a window is being added or made
686 * visible, once the window has been shown then the system will
687 * poke the power manager's user activity (as if the user had woken
688 * up the device) to turn the screen on. */
689 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
690
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700691 /** Window flag: when set the window will cause the keyguard to
692 * be dismissed, only if it is not a secure lock keyguard. Because such
693 * a keyguard is not needed for security, it will never re-appear if
694 * the user navigates to another window (in contrast to
695 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
696 * hide both secure and non-secure keyguards but ensure they reappear
697 * when the user moves to another UI that doesn't hide them).
698 * If the keyguard is currently active and is secure (requires an
699 * unlock pattern) than the user will still need to confirm it before
700 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
Daniel Sandlerae069f72010-06-17 21:56:26 -0400701 * also been set.
702 */
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700703 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
Jeff Brown01ce2e92010-09-26 22:20:12 -0700704
705 /** Window flag: when set the window will accept for touch events
706 * outside of its bounds to be sent to other windows that also
707 * support split touch. When this flag is not set, the first pointer
708 * that goes down determines the window to which all subsequent touches
709 * go until all pointers go up. When this flag is set, each pointer
710 * (not necessarily the first) that goes down determines the window
711 * to which all subsequent touches of that pointer will go until that
712 * pointer goes up thereby enabling touches with multiple pointers
713 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800714 */
Jeff Brown01ce2e92010-09-26 22:20:12 -0700715 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800716
717 /**
Romain Guy72f0a272011-01-09 16:01:46 -0800718 * <p>Indicates whether this window should be hardware accelerated.
719 * Requesting hardware acceleration does not guarantee it will happen.</p>
720 *
721 * <p>This flag can be controlled programmatically <em>only</em> to enable
722 * hardware acceleration. To enable hardware acceleration for a given
723 * window programmatically, do the following:</p>
724 *
725 * <pre>
726 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
727 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
728 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
729 * </pre>
730 *
731 * <p>It is important to remember that this flag <strong>must</strong>
732 * be set before setting the content view of your activity or dialog.</p>
733 *
734 * <p>This flag cannot be used to disable hardware acceleration after it
735 * was enabled in your manifest using
736 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
737 * and programmatically disable hardware acceleration (for automated testing
738 * for instance), make sure it is turned off in your manifest and enable it
739 * on your activity or dialog when you need it instead, using the method
740 * described above.</p>
741 *
742 * <p>This flag is automatically set by the system if the
743 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
744 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800745 */
746 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -0400747
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800748 // ----- HIDDEN FLAGS.
749 // These start at the high bit and go down.
Jeff Brown98db5fa2011-06-08 15:37:10 -0700750
751 /** Window flag: Enable touches to slide out of a window into neighboring
752 * windows in mid-gesture instead of being captured for the duration of
753 * the gesture.
754 *
755 * This flag changes the behavior of touch focus for this window only.
756 * Touches can slide out of the window but they cannot necessarily slide
757 * back in (unless the other window with touch focus permits it).
758 *
759 * {@hide}
760 */
761 public static final int FLAG_SLIPPERY = 0x04000000;
762
Daniel Sandlere02d8082010-10-08 15:13:22 -0400763 /**
764 * Flag for a window belonging to an activity that responds to {@link KeyEvent#KEYCODE_MENU}
765 * and therefore needs a Menu key. For devices where Menu is a physical button this flag is
766 * ignored, but on devices where the Menu key is drawn in software it may be hidden unless
767 * this flag is set.
768 *
769 * (Note that Action Bars, when available, are the preferred way to offer additional
770 * functions otherwise accessed via an options menu.)
771 *
772 * {@hide}
773 */
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800774 public static final int FLAG_NEEDS_MENU_KEY = 0x08000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -0400775
Mitsuru Oshima1ecf5d22009-07-06 17:20:38 -0700776 /** Window flag: special flag to limit the size of the window to be
777 * original size ([320x480] x density). Used to create window for applications
778 * running under compatibility mode.
779 *
780 * {@hide} */
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700781 public static final int FLAG_COMPATIBLE_WINDOW = 0x20000000;
Mitsuru Oshima1ecf5d22009-07-06 17:20:38 -0700782
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800783 /** Window flag: a special option intended for system dialogs. When
784 * this flag is set, the window will demand focus unconditionally when
785 * it is created.
786 * {@hide} */
787 public static final int FLAG_SYSTEM_ERROR = 0x40000000;
788
789 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700790 * Various behavioral options/flags. Default is none.
791 *
792 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
793 * @see #FLAG_DIM_BEHIND
794 * @see #FLAG_NOT_FOCUSABLE
795 * @see #FLAG_NOT_TOUCHABLE
796 * @see #FLAG_NOT_TOUCH_MODAL
797 * @see #FLAG_TOUCHABLE_WHEN_WAKING
798 * @see #FLAG_KEEP_SCREEN_ON
799 * @see #FLAG_LAYOUT_IN_SCREEN
800 * @see #FLAG_LAYOUT_NO_LIMITS
801 * @see #FLAG_FULLSCREEN
802 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700803 * @see #FLAG_SECURE
804 * @see #FLAG_SCALED
805 * @see #FLAG_IGNORE_CHEEK_PRESSES
806 * @see #FLAG_LAYOUT_INSET_DECOR
807 * @see #FLAG_ALT_FOCUSABLE_IM
808 * @see #FLAG_WATCH_OUTSIDE_TOUCH
809 * @see #FLAG_SHOW_WHEN_LOCKED
810 * @see #FLAG_SHOW_WALLPAPER
811 * @see #FLAG_TURN_SCREEN_ON
812 * @see #FLAG_DISMISS_KEYGUARD
813 * @see #FLAG_SPLIT_TOUCH
814 * @see #FLAG_HARDWARE_ACCELERATED
815 */
816 @ViewDebug.ExportedProperty(flagMapping = {
817 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
818 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
819 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
820 name = "FLAG_DIM_BEHIND"),
821 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
822 name = "FLAG_BLUR_BEHIND"),
823 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
824 name = "FLAG_NOT_FOCUSABLE"),
825 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
826 name = "FLAG_NOT_TOUCHABLE"),
827 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
828 name = "FLAG_NOT_TOUCH_MODAL"),
829 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
830 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
831 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
832 name = "FLAG_KEEP_SCREEN_ON"),
833 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
834 name = "FLAG_LAYOUT_IN_SCREEN"),
835 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
836 name = "FLAG_LAYOUT_NO_LIMITS"),
837 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
838 name = "FLAG_FULLSCREEN"),
839 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
840 name = "FLAG_FORCE_NOT_FULLSCREEN"),
841 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
842 name = "FLAG_DITHER"),
843 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
844 name = "FLAG_SECURE"),
845 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
846 name = "FLAG_SCALED"),
847 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
848 name = "FLAG_IGNORE_CHEEK_PRESSES"),
849 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
850 name = "FLAG_LAYOUT_INSET_DECOR"),
851 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
852 name = "FLAG_ALT_FOCUSABLE_IM"),
853 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
854 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
855 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
856 name = "FLAG_SHOW_WHEN_LOCKED"),
857 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
858 name = "FLAG_SHOW_WALLPAPER"),
859 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
860 name = "FLAG_TURN_SCREEN_ON"),
861 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
862 name = "FLAG_DISMISS_KEYGUARD"),
863 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
864 name = "FLAG_SPLIT_TOUCH"),
865 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
866 name = "FLAG_HARDWARE_ACCELERATED")
867 })
868 public int flags;
869
870 /**
871 * If the window has requested hardware acceleration, but this is not
872 * allowed in the process it is in, then still render it as if it is
873 * hardware accelerated. This is used for the starting preview windows
874 * in the system process, which don't need to have the overhead of
875 * hardware acceleration (they are just a static rendering), but should
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900876 * be rendered as such to match the actual window of the app even if it
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700877 * is hardware accelerated.
878 * Even if the window isn't hardware accelerated, still do its rendering
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900879 * as if it was.
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700880 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
881 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
882 * is generally disabled. This flag must be specified in addition to
883 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
884 * windows.
885 *
886 * @hide
887 */
888 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
889
890 /**
891 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900892 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700893 * If certain parts of the UI that really do want to use hardware
894 * acceleration, this flag can be set to force it. This is basically
895 * for the lock screen. Anyone else using it, you are probably wrong.
896 *
897 * @hide
898 */
899 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
900
901 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -0700902 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900903 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -0700904 * them (they do not affect the wallpaper scrolling operation) by calling
905 * {@link
906 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
907 *
908 * @hide
909 */
910 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
911
912 /**
Dianne Hackborn73ab6a42011-12-13 11:16:23 -0800913 * This is set for a window that has explicitly specified its
914 * FLAG_NEEDS_MENU_KEY, so we know the value on this window is the
915 * appropriate one to use. If this is not set, we should look at
916 * windows behind it to determine the appropriate value.
917 *
918 * @hide
919 */
920 public static final int PRIVATE_FLAG_SET_NEEDS_MENU_KEY = 0x00000008;
921
Craig Mautner88400d32012-09-30 12:35:45 -0700922 /** In a multiuser system if this flag is set and the owner is a system process then this
923 * window will appear on all user screens. This overrides the default behavior of window
924 * types that normally only appear on the owning user's screen. Refer to each window type
925 * to determine its default behavior.
926 *
927 * {@hide} */
928 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
929
Dianne Hackborn73ab6a42011-12-13 11:16:23 -0800930 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700931 * Control flags that are private to the platform.
932 * @hide
933 */
934 public int privateFlags;
935
936 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800937 * Given a particular set of window manager flags, determine whether
938 * such a window may be a target for an input method when it has
939 * focus. In particular, this checks the
940 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
941 * flags and returns true if the combination of the two corresponds
942 * to a window that needs to be behind the input method so that the
943 * user can type into it.
944 *
945 * @param flags The current window manager flags.
946 *
947 * @return Returns true if such a window should be behind/interact
948 * with an input method, false if not.
949 */
950 public static boolean mayUseInputMethod(int flags) {
951 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
952 case 0:
953 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
954 return true;
955 }
956 return false;
957 }
958
959 /**
960 * Mask for {@link #softInputMode} of the bits that determine the
961 * desired visibility state of the soft input area for this window.
962 */
963 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
964
965 /**
966 * Visibility state for {@link #softInputMode}: no state has been specified.
967 */
968 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
969
970 /**
971 * Visibility state for {@link #softInputMode}: please don't change the state of
972 * the soft input area.
973 */
974 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
975
976 /**
977 * Visibility state for {@link #softInputMode}: please hide any soft input
978 * area when normally appropriate (when the user is navigating
979 * forward to your window).
980 */
981 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
982
983 /**
984 * Visibility state for {@link #softInputMode}: please always hide any
985 * soft input area when this window receives focus.
986 */
987 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
988
989 /**
990 * Visibility state for {@link #softInputMode}: please show the soft
991 * input area when normally appropriate (when the user is navigating
992 * forward to your window).
993 */
994 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
995
996 /**
997 * Visibility state for {@link #softInputMode}: please always make the
998 * soft input area visible when this window receives input focus.
999 */
1000 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
1001
1002 /**
1003 * Mask for {@link #softInputMode} of the bits that determine the
1004 * way that the window should be adjusted to accommodate the soft
1005 * input window.
1006 */
1007 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
1008
1009 /** Adjustment option for {@link #softInputMode}: nothing specified.
1010 * The system will try to pick one or
1011 * the other depending on the contents of the window.
1012 */
1013 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
1014
1015 /** Adjustment option for {@link #softInputMode}: set to allow the
1016 * window to be resized when an input
1017 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07001018 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001019 * {@link #SOFT_INPUT_ADJUST_PAN}; if
1020 * neither of these are set, then the system will try to pick one or
1021 * the other depending on the contents of the window.
1022 */
1023 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
1024
1025 /** Adjustment option for {@link #softInputMode}: set to have a window
1026 * pan when an input method is
1027 * shown, so it doesn't need to deal with resizing but just panned
1028 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07001029 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001030 * neither of these are set, then the system will try to pick one or
1031 * the other depending on the contents of the window.
1032 */
1033 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
1034
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001035 /** Adjustment option for {@link #softInputMode}: set to have a window
1036 * not adjust for a shown input method. The window will not be resized,
1037 * and it will not be panned to make its focus visible.
1038 */
1039 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
1040
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001041 /**
1042 * Bit for {@link #softInputMode}: set when the user has navigated
1043 * forward to the window. This is normally set automatically for
1044 * you by the system, though you may want to set it in certain cases
1045 * when you are displaying a window yourself. This flag will always
1046 * be cleared automatically after the window is displayed.
1047 */
1048 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001049
1050 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08001051 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001052 * of:
1053 *
1054 * <ul>
1055 * <li> One of the visibility states
1056 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
1057 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or
1058 * {@link #SOFT_INPUT_STATE_VISIBLE}.
1059 * <li> One of the adjustment options
1060 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},
1061 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or
1062 * {@link #SOFT_INPUT_ADJUST_PAN}.
1063 */
1064 public int softInputMode;
1065
1066 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001067 * Placement of window within the screen as per {@link Gravity}. Both
1068 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1069 * android.graphics.Rect) Gravity.apply} and
1070 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1071 * Gravity.applyDisplay} are used during window layout, with this value
1072 * given as the desired gravity. For example you can specify
1073 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
1074 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
1075 * to control the behavior of
1076 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1077 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001078 *
1079 * @see Gravity
1080 */
1081 public int gravity;
1082
1083 /**
1084 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001085 * between the container and the widget. See
1086 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1087 * android.graphics.Rect) Gravity.apply} for how this is used. This
1088 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001089 */
1090 public float horizontalMargin;
1091
1092 /**
1093 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001094 * between the container and the widget. See
1095 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1096 * android.graphics.Rect) Gravity.apply} for how this is used. This
1097 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 */
1099 public float verticalMargin;
1100
1101 /**
1102 * The desired bitmap format. May be one of the constants in
1103 * {@link android.graphics.PixelFormat}. Default is OPAQUE.
1104 */
1105 public int format;
1106
1107 /**
1108 * A style resource defining the animations to use for this window.
1109 * This must be a system resource; it can not be an application resource
1110 * because the window manager does not have access to applications.
1111 */
1112 public int windowAnimations;
1113
1114 /**
1115 * An alpha value to apply to this entire window.
1116 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1117 */
1118 public float alpha = 1.0f;
1119
1120 /**
1121 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1122 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1123 * dim.
1124 */
1125 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001126
1127 /**
1128 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1129 * indicating that the brightness value is not overridden for this window
1130 * and normal brightness policy should be used.
1131 */
1132 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1133
1134 /**
1135 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1136 * indicating that the screen or button backlight brightness should be set
1137 * to the lowest value when this window is in front.
1138 */
1139 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1140
1141 /**
1142 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1143 * indicating that the screen or button backlight brightness should be set
1144 * to the hightest value when this window is in front.
1145 */
1146 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147
1148 /**
1149 * This can be used to override the user's preferred brightness of
1150 * the screen. A value of less than 0, the default, means to use the
1151 * preferred screen brightness. 0 to 1 adjusts the brightness from
1152 * dark to full bright.
1153 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001154 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001155
1156 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001157 * This can be used to override the standard behavior of the button and
1158 * keyboard backlights. A value of less than 0, the default, means to
1159 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1160 * from dark to full bright.
1161 */
1162 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1163
1164 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001165 * Identifier for this window. This will usually be filled in for
1166 * you.
1167 */
1168 public IBinder token = null;
1169
1170 /**
1171 * Name of the package owning this window.
1172 */
1173 public String packageName = null;
1174
1175 /**
1176 * Specific orientation value for a window.
1177 * May be any of the same values allowed
1178 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1179 * If not set, a default value of
1180 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
1181 * will be used.
1182 */
1183 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001184
1185 /**
1186 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001187 *
1188 * @see View#STATUS_BAR_VISIBLE
1189 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001190 */
1191 public int systemUiVisibility;
1192
1193 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001194 * @hide
1195 * The ui visibility as requested by the views in this hierarchy.
1196 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1197 */
1198 public int subtreeSystemUiVisibility;
1199
1200 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001201 * Get callbacks about the system ui visibility changing.
1202 *
1203 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1204 *
1205 * @hide
1206 */
1207 public boolean hasSystemUiListeners;
1208
Jeff Brown474dcb52011-06-14 20:22:50 -07001209 /**
1210 * When this window has focus, disable touch pad pointer gesture processing.
1211 * The window will receive raw position updates from the touch pad instead
1212 * of pointer movements and synthetic touch events.
1213 *
1214 * @hide
1215 */
1216 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1217
1218 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001219 * Does not construct an input channel for this window. The channel will therefore
1220 * be incapable of receiving input.
1221 *
1222 * @hide
1223 */
1224 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1225
1226 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001227 * When this window has focus, does not call user activity for all input events so
1228 * the application will have to do it itself. Should only be used by
1229 * the keyguard and phone app.
1230 * <p>
1231 * Should only be used by the keyguard and phone app.
1232 * </p>
1233 *
1234 * @hide
1235 */
1236 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
1237
1238 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001239 * Control special features of the input subsystem.
1240 *
1241 * @see #INPUT_FEATURE_DISABLE_TOUCH_PAD_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001242 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001243 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07001244 * @hide
1245 */
1246 public int inputFeatures;
1247
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001248 /**
1249 * Sets the number of milliseconds before the user activity timeout occurs
1250 * when this window has focus. A value of -1 uses the standard timeout.
1251 * A value of 0 uses the minimum support display timeout.
1252 * <p>
1253 * This property can only be used to reduce the user specified display timeout;
1254 * it can never make the timeout longer than it normally would be.
1255 * </p><p>
1256 * Should only be used by the keyguard and phone app.
1257 * </p>
1258 *
1259 * @hide
1260 */
1261 public long userActivityTimeout = -1;
1262
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001263 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001264 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001265 type = TYPE_APPLICATION;
1266 format = PixelFormat.OPAQUE;
1267 }
1268
1269 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001270 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 type = _type;
1272 format = PixelFormat.OPAQUE;
1273 }
1274
1275 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001276 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001277 type = _type;
1278 flags = _flags;
1279 format = PixelFormat.OPAQUE;
1280 }
1281
1282 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08001283 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001284 type = _type;
1285 flags = _flags;
1286 format = _format;
1287 }
1288
1289 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
1290 super(w, h);
1291 type = _type;
1292 flags = _flags;
1293 format = _format;
1294 }
1295
1296 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
1297 int _flags, int _format) {
1298 super(w, h);
1299 x = xpos;
1300 y = ypos;
1301 type = _type;
1302 flags = _flags;
1303 format = _format;
1304 }
1305
1306 public final void setTitle(CharSequence title) {
1307 if (null == title)
1308 title = "";
1309
1310 mTitle = TextUtils.stringOrSpannedString(title);
1311 }
1312
1313 public final CharSequence getTitle() {
1314 return mTitle;
1315 }
1316
1317 public int describeContents() {
1318 return 0;
1319 }
1320
1321 public void writeToParcel(Parcel out, int parcelableFlags) {
1322 out.writeInt(width);
1323 out.writeInt(height);
1324 out.writeInt(x);
1325 out.writeInt(y);
1326 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001327 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001328 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001329 out.writeInt(softInputMode);
1330 out.writeInt(gravity);
1331 out.writeFloat(horizontalMargin);
1332 out.writeFloat(verticalMargin);
1333 out.writeInt(format);
1334 out.writeInt(windowAnimations);
1335 out.writeFloat(alpha);
1336 out.writeFloat(dimAmount);
1337 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001338 out.writeFloat(buttonBrightness);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001339 out.writeStrongBinder(token);
1340 out.writeString(packageName);
1341 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
1342 out.writeInt(screenOrientation);
Joe Onorato664644d2011-01-23 17:53:23 -08001343 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08001344 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08001345 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07001346 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001347 out.writeLong(userActivityTimeout);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001348 }
1349
1350 public static final Parcelable.Creator<LayoutParams> CREATOR
1351 = new Parcelable.Creator<LayoutParams>() {
1352 public LayoutParams createFromParcel(Parcel in) {
1353 return new LayoutParams(in);
1354 }
1355
1356 public LayoutParams[] newArray(int size) {
1357 return new LayoutParams[size];
1358 }
1359 };
1360
1361
1362 public LayoutParams(Parcel in) {
1363 width = in.readInt();
1364 height = in.readInt();
1365 x = in.readInt();
1366 y = in.readInt();
1367 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001369 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001370 softInputMode = in.readInt();
1371 gravity = in.readInt();
1372 horizontalMargin = in.readFloat();
1373 verticalMargin = in.readFloat();
1374 format = in.readInt();
1375 windowAnimations = in.readInt();
1376 alpha = in.readFloat();
1377 dimAmount = in.readFloat();
1378 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001379 buttonBrightness = in.readFloat();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001380 token = in.readStrongBinder();
1381 packageName = in.readString();
1382 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
1383 screenOrientation = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001384 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08001385 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001386 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07001387 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001388 userActivityTimeout = in.readLong();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001389 }
1390
Romain Guy72998072009-06-22 11:09:20 -07001391 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001392 public static final int LAYOUT_CHANGED = 1<<0;
1393 public static final int TYPE_CHANGED = 1<<1;
1394 public static final int FLAGS_CHANGED = 1<<2;
1395 public static final int FORMAT_CHANGED = 1<<3;
1396 public static final int ANIMATION_CHANGED = 1<<4;
1397 public static final int DIM_AMOUNT_CHANGED = 1<<5;
1398 public static final int TITLE_CHANGED = 1<<6;
1399 public static final int ALPHA_CHANGED = 1<<7;
1400 public static final int MEMORY_TYPE_CHANGED = 1<<8;
1401 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
1402 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
1403 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001404 /** {@hide} */
1405 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<12;
Joe Onorato664644d2011-01-23 17:53:23 -08001406 /** {@hide} */
1407 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<13;
1408 /** {@hide} */
1409 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<14;
Jeff Brown474dcb52011-06-14 20:22:50 -07001410 /** {@hide} */
1411 public static final int INPUT_FEATURES_CHANGED = 1<<15;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001412 /** {@hide} */
1413 public static final int PRIVATE_FLAGS_CHANGED = 1<<16;
Romain Guyf21c9b02011-09-06 16:56:54 -07001414 /** {@hide} */
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001415 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<17;
1416 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07001417 public static final int EVERYTHING_CHANGED = 0xffffffff;
1418
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001419 // internal buffer to backup/restore parameters under compatibility mode.
1420 private int[] mCompatibilityParamsBackup = null;
1421
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 public final int copyFrom(LayoutParams o) {
1423 int changes = 0;
1424
1425 if (width != o.width) {
1426 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07001427 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001428 }
1429 if (height != o.height) {
1430 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07001431 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001432 }
1433 if (x != o.x) {
1434 x = o.x;
1435 changes |= LAYOUT_CHANGED;
1436 }
1437 if (y != o.y) {
1438 y = o.y;
1439 changes |= LAYOUT_CHANGED;
1440 }
1441 if (horizontalWeight != o.horizontalWeight) {
1442 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001443 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001444 }
1445 if (verticalWeight != o.verticalWeight) {
1446 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001447 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001448 }
1449 if (horizontalMargin != o.horizontalMargin) {
1450 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001451 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001452 }
1453 if (verticalMargin != o.verticalMargin) {
1454 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001455 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001456 }
1457 if (type != o.type) {
1458 type = o.type;
1459 changes |= TYPE_CHANGED;
1460 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001461 if (flags != o.flags) {
1462 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07001463 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001464 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001465 if (privateFlags != o.privateFlags) {
1466 privateFlags = o.privateFlags;
1467 changes |= PRIVATE_FLAGS_CHANGED;
1468 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001469 if (softInputMode != o.softInputMode) {
1470 softInputMode = o.softInputMode;
1471 changes |= SOFT_INPUT_MODE_CHANGED;
1472 }
1473 if (gravity != o.gravity) {
1474 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07001475 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001476 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001477 if (format != o.format) {
1478 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07001479 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001480 }
1481 if (windowAnimations != o.windowAnimations) {
1482 windowAnimations = o.windowAnimations;
1483 changes |= ANIMATION_CHANGED;
1484 }
1485 if (token == null) {
1486 // NOTE: token only copied if the recipient doesn't
1487 // already have one.
1488 token = o.token;
1489 }
1490 if (packageName == null) {
1491 // NOTE: packageName only copied if the recipient doesn't
1492 // already have one.
1493 packageName = o.packageName;
1494 }
1495 if (!mTitle.equals(o.mTitle)) {
1496 mTitle = o.mTitle;
1497 changes |= TITLE_CHANGED;
1498 }
1499 if (alpha != o.alpha) {
1500 alpha = o.alpha;
1501 changes |= ALPHA_CHANGED;
1502 }
1503 if (dimAmount != o.dimAmount) {
1504 dimAmount = o.dimAmount;
1505 changes |= DIM_AMOUNT_CHANGED;
1506 }
1507 if (screenBrightness != o.screenBrightness) {
1508 screenBrightness = o.screenBrightness;
1509 changes |= SCREEN_BRIGHTNESS_CHANGED;
1510 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001511 if (buttonBrightness != o.buttonBrightness) {
1512 buttonBrightness = o.buttonBrightness;
1513 changes |= BUTTON_BRIGHTNESS_CHANGED;
1514 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001515
1516 if (screenOrientation != o.screenOrientation) {
1517 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07001518 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001519 }
Romain Guy529b60a2010-08-03 18:05:47 -07001520
Joe Onorato14782f72011-01-25 19:53:17 -08001521 if (systemUiVisibility != o.systemUiVisibility
1522 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08001523 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08001524 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08001525 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
1526 }
1527
1528 if (hasSystemUiListeners != o.hasSystemUiListeners) {
1529 hasSystemUiListeners = o.hasSystemUiListeners;
1530 changes |= SYSTEM_UI_LISTENER_CHANGED;
1531 }
1532
Jeff Brown474dcb52011-06-14 20:22:50 -07001533 if (inputFeatures != o.inputFeatures) {
1534 inputFeatures = o.inputFeatures;
1535 changes |= INPUT_FEATURES_CHANGED;
1536 }
1537
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001538 if (userActivityTimeout != o.userActivityTimeout) {
1539 userActivityTimeout = o.userActivityTimeout;
1540 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
1541 }
1542
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001543 return changes;
1544 }
1545
1546 @Override
1547 public String debug(String output) {
1548 output += "Contents of " + this + ":";
1549 Log.d("Debug", output);
1550 output = super.debug("");
1551 Log.d("Debug", output);
1552 Log.d("Debug", "");
1553 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
1554 return "";
1555 }
1556
1557 @Override
1558 public String toString() {
1559 StringBuilder sb = new StringBuilder(256);
1560 sb.append("WM.LayoutParams{");
1561 sb.append("(");
1562 sb.append(x);
1563 sb.append(',');
1564 sb.append(y);
1565 sb.append(")(");
Romain Guy980a9382010-01-08 15:06:28 -08001566 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001567 sb.append('x');
Romain Guy980a9382010-01-08 15:06:28 -08001568 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001569 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001570 if (horizontalMargin != 0) {
1571 sb.append(" hm=");
1572 sb.append(horizontalMargin);
1573 }
1574 if (verticalMargin != 0) {
1575 sb.append(" vm=");
1576 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001577 }
1578 if (gravity != 0) {
1579 sb.append(" gr=#");
1580 sb.append(Integer.toHexString(gravity));
1581 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001582 if (softInputMode != 0) {
1583 sb.append(" sim=#");
1584 sb.append(Integer.toHexString(softInputMode));
1585 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001586 sb.append(" ty=");
1587 sb.append(type);
1588 sb.append(" fl=#");
1589 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001590 if (privateFlags != 0) {
1591 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
1592 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001593 if (format != PixelFormat.OPAQUE) {
1594 sb.append(" fmt=");
1595 sb.append(format);
1596 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001597 if (windowAnimations != 0) {
1598 sb.append(" wanim=0x");
1599 sb.append(Integer.toHexString(windowAnimations));
1600 }
1601 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
1602 sb.append(" or=");
1603 sb.append(screenOrientation);
1604 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001605 if (alpha != 1.0f) {
1606 sb.append(" alpha=");
1607 sb.append(alpha);
1608 }
1609 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1610 sb.append(" sbrt=");
1611 sb.append(screenBrightness);
1612 }
1613 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1614 sb.append(" bbrt=");
1615 sb.append(buttonBrightness);
1616 }
Mitsuru Oshima5a2b91d2009-07-16 16:30:02 -07001617 if ((flags & FLAG_COMPATIBLE_WINDOW) != 0) {
1618 sb.append(" compatible=true");
1619 }
Joe Onorato664644d2011-01-23 17:53:23 -08001620 if (systemUiVisibility != 0) {
1621 sb.append(" sysui=0x");
1622 sb.append(Integer.toHexString(systemUiVisibility));
1623 }
Joe Onorato14782f72011-01-25 19:53:17 -08001624 if (subtreeSystemUiVisibility != 0) {
1625 sb.append(" vsysui=0x");
1626 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
1627 }
Joe Onorato664644d2011-01-23 17:53:23 -08001628 if (hasSystemUiListeners) {
1629 sb.append(" sysuil=");
1630 sb.append(hasSystemUiListeners);
1631 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001632 if (inputFeatures != 0) {
1633 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
1634 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001635 if (userActivityTimeout >= 0) {
1636 sb.append(" userActivityTimeout=").append(userActivityTimeout);
1637 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001638 sb.append('}');
1639 return sb.toString();
1640 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001641
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001642 /**
1643 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001644 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001645 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001646 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001647 x = (int) (x * scale + 0.5f);
1648 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001649 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001650 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001651 }
1652 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001653 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001654 }
1655 }
1656
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001657 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001658 * Backup the layout parameters used in compatibility mode.
1659 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001660 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001661 void backup() {
1662 int[] backup = mCompatibilityParamsBackup;
1663 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001664 // we backup 4 elements, x, y, width, height
1665 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001666 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001667 backup[0] = x;
1668 backup[1] = y;
1669 backup[2] = width;
1670 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001671 }
1672
1673 /**
1674 * Restore the layout params' coordinates, size and gravity
1675 * @see LayoutParams#backup()
1676 */
1677 void restore() {
1678 int[] backup = mCompatibilityParamsBackup;
1679 if (backup != null) {
1680 x = backup[0];
1681 y = backup[1];
1682 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001683 height = backup[3];
1684 }
1685 }
1686
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001687 private CharSequence mTitle = "";
1688 }
1689}