blob: c06b5d8f50a90674b7b2f396a5e573025385d54f [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;
Alan Viveretteccb11e12014-07-08 16:04:02 -070022import android.graphics.Insets;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.graphics.PixelFormat;
Alan Viveretteccb11e12014-07-08 16:04:02 -070024import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.os.IBinder;
26import android.os.Parcel;
27import android.os.Parcelable;
28import android.text.TextUtils;
29import android.util.Log;
30
31
32/**
33 * The interface that apps use to talk to the window manager.
34 * <p>
35 * Use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> to get one of these.
Jeff Browna492c3a2012-08-23 19:48:44 -070036 * </p><p>
37 * Each window manager instance is bound to a particular {@link Display}.
38 * To obtain a {@link WindowManager} for a different display, use
39 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
40 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
41 * to get the WindowManager.
42 * </p><p>
43 * The simplest way to show a window on another display is to create a
44 * {@link Presentation}. The presentation will automatically obtain a
45 * {@link WindowManager} and {@link Context} for that display.
46 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047 *
48 * @see android.content.Context#getSystemService
49 * @see android.content.Context#WINDOW_SERVICE
50 */
51public interface WindowManager extends ViewManager {
52 /**
53 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +010054 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055 * is invalid.
56 */
57 public static class BadTokenException extends RuntimeException {
58 public BadTokenException() {
59 }
60
61 public BadTokenException(String name) {
62 super(name);
63 }
64 }
65
66 /**
Craig Mautner6018aee2012-10-23 14:27:49 -070067 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
68 * be found. See {@link android.app.Presentation} for more information on secondary displays.
69 */
70 public static class InvalidDisplayException extends RuntimeException {
71 public InvalidDisplayException() {
72 }
73
74 public InvalidDisplayException(String name) {
75 super(name);
76 }
77 }
78
79 /**
Jeff Browna492c3a2012-08-23 19:48:44 -070080 * Returns the {@link Display} upon which this {@link WindowManager} instance
81 * will create new windows.
82 * <p>
83 * Despite the name of this method, the display that is returned is not
84 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
85 * The returned display could instead be a secondary display that this
86 * window manager instance is managing. Think of it as the display that
87 * this {@link WindowManager} instance uses by default.
88 * </p><p>
89 * To create windows on a different display, you need to obtain a
90 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
91 * class documentation for more information.)
92 * </p>
93 *
94 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 */
96 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -070097
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 /**
99 * Special variation of {@link #removeView} that immediately invokes
100 * the given view hierarchy's {@link View#onDetachedFromWindow()
101 * View.onDetachedFromWindow()} methods before returning. This is not
102 * for normal applications; using it correctly requires great care.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000103 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800104 * @param view The view to be removed.
105 */
106 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700107
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 public static class LayoutParams extends ViewGroup.LayoutParams
109 implements Parcelable {
110 /**
111 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700112 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
113 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800114 */
Romain Guy529b60a2010-08-03 18:05:47 -0700115 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 public int x;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000117
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 /**
119 * Y position for this window. With the default gravity it is ignored.
120 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
121 * an offset from the given edge.
122 */
Romain Guy529b60a2010-08-03 18:05:47 -0700123 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 public int y;
125
126 /**
127 * Indicates how much of the extra space will be allocated horizontally
128 * to the view associated with these LayoutParams. Specify 0 if the view
129 * should not be stretched. Otherwise the extra pixels will be pro-rated
130 * among all views whose weight is greater than 0.
131 */
Romain Guy529b60a2010-08-03 18:05:47 -0700132 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133 public float horizontalWeight;
134
135 /**
136 * Indicates how much of the extra space will be allocated vertically
137 * to the view associated with these LayoutParams. Specify 0 if the view
138 * should not be stretched. Otherwise the extra pixels will be pro-rated
139 * among all views whose weight is greater than 0.
140 */
Romain Guy529b60a2010-08-03 18:05:47 -0700141 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700143
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 /**
145 * The general type of window. There are three main classes of
146 * window types:
147 * <ul>
148 * <li> <strong>Application windows</strong> (ranging from
149 * {@link #FIRST_APPLICATION_WINDOW} to
150 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
151 * windows. For these types of windows, the {@link #token} must be
152 * set to the token of the activity they are a part of (this will
153 * normally be done for you if {@link #token} is null).
154 * <li> <strong>Sub-windows</strong> (ranging from
155 * {@link #FIRST_SUB_WINDOW} to
156 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
157 * window. For these types of windows, the {@link #token} must be
158 * the token of the window it is attached to.
159 * <li> <strong>System windows</strong> (ranging from
160 * {@link #FIRST_SYSTEM_WINDOW} to
161 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
162 * use by the system for specific purposes. They should not normally
163 * be used by applications, and a special permission is required
164 * to use them.
165 * </ul>
Wonsik Kim475e3f02014-03-17 11:17:47 +0000166 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800167 * @see #TYPE_BASE_APPLICATION
168 * @see #TYPE_APPLICATION
169 * @see #TYPE_APPLICATION_STARTING
170 * @see #TYPE_APPLICATION_PANEL
171 * @see #TYPE_APPLICATION_MEDIA
172 * @see #TYPE_APPLICATION_SUB_PANEL
173 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
174 * @see #TYPE_STATUS_BAR
175 * @see #TYPE_SEARCH_BAR
176 * @see #TYPE_PHONE
177 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800178 * @see #TYPE_TOAST
179 * @see #TYPE_SYSTEM_OVERLAY
180 * @see #TYPE_PRIORITY_PHONE
181 * @see #TYPE_STATUS_BAR_PANEL
182 * @see #TYPE_SYSTEM_DIALOG
183 * @see #TYPE_KEYGUARD_DIALOG
184 * @see #TYPE_SYSTEM_ERROR
185 * @see #TYPE_INPUT_METHOD
186 * @see #TYPE_INPUT_METHOD_DIALOG
187 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700188 @ViewDebug.ExportedProperty(mapping = {
189 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
190 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
191 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
192 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
193 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
194 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
195 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700196 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700197 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
198 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
199 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
200 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700201 @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"),
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700223 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION"),
224 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, to = "TYPE_VOICE_INTERACTION"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700225 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800226 public int type;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000227
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800228 /**
229 * Start of window types that represent normal application windows.
230 */
231 public static final int FIRST_APPLICATION_WINDOW = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000232
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800233 /**
234 * Window type: an application window that serves as the "base" window
235 * of the overall application; all other application windows will
236 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700237 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800238 */
239 public static final int TYPE_BASE_APPLICATION = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000240
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800241 /**
242 * Window type: a normal application window. The {@link #token} must be
243 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700244 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 */
246 public static final int TYPE_APPLICATION = 2;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800248 /**
249 * Window type: special application window that is displayed while the
250 * application is starting. Not for use by applications themselves;
251 * this is used by the system to display something until the
252 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700253 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800254 */
255 public static final int TYPE_APPLICATION_STARTING = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000256
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800257 /**
258 * End of types of application windows.
259 */
260 public static final int LAST_APPLICATION_WINDOW = 99;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000261
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800262 /**
263 * Start of types of sub-windows. The {@link #token} of these windows
264 * must be set to the window they are attached to. These types of
265 * windows are kept next to their attached window in Z-order, and their
266 * coordinate space is relative to their attached window.
267 */
268 public static final int FIRST_SUB_WINDOW = 1000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000269
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800270 /**
271 * Window type: a panel on top of an application window. These windows
272 * appear on top of their attached window.
273 */
274 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000275
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800276 /**
John Spurlock33291d82013-03-13 14:45:14 -0400277 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800278 * are displayed behind their attached window.
279 */
280 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000281
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800282 /**
283 * Window type: a sub-panel on top of an application window. These
284 * windows are displayed on top their attached window and any
285 * {@link #TYPE_APPLICATION_PANEL} panels.
286 */
287 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW+2;
288
289 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
290 * of the window happens as that of a top-level window, <em>not</em>
291 * as a child of its container.
292 */
293 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000294
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700296 * Window type: window for showing overlays on top of media windows.
297 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
298 * application window. They should be translucent to be useful. This
299 * is a big ugly hack so:
300 * @hide
301 */
302 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000303
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700304 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800305 * End of types of sub-windows.
306 */
307 public static final int LAST_SUB_WINDOW = 1999;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000308
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800309 /**
310 * Start of system-specific window types. These are not normally
311 * created by applications.
312 */
313 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000314
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800315 /**
316 * Window type: the status bar. There can be only one status bar
317 * window; it is placed at the top of the screen, and all other
318 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700319 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800320 */
321 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000322
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800323 /**
324 * Window type: the search bar. There can be only one search bar
325 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700326 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800327 */
328 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000329
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800330 /**
331 * Window type: phone. These are non-application windows providing
332 * user interaction with the phone (in particular incoming calls).
333 * These windows are normally placed above all applications, but behind
334 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700335 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800336 */
337 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000338
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800339 /**
340 * Window type: system window, such as low power alert. These windows
341 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700342 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800343 */
344 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100345
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800346 /**
347 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700348 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800349 */
350 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100351
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800352 /**
353 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700354 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800355 */
356 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000357
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800358 /**
359 * Window type: system overlay windows, which need to be displayed
360 * on top of everything else. These windows must not take input
361 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700362 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 */
364 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000365
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800366 /**
367 * Window type: priority phone UI, which needs to be displayed even if
368 * the keyguard is active. These windows must not take input
369 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700370 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 */
372 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000373
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800374 /**
375 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700376 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800377 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800378 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000379
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 /**
381 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700382 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800383 */
384 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 /**
387 * Window type: internal system error windows, appear on top of
388 * everything they can.
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_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000392
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800393 /**
394 * Window type: internal input methods windows, which appear above
395 * the normal UI. Application windows may be resized or panned to keep
396 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700397 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800398 */
399 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
400
401 /**
402 * Window type: internal input methods dialog windows, which appear above
403 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700404 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800405 */
406 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
407
408 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700409 * Window type: wallpaper window, placed behind any window that wants
410 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700411 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700412 */
413 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
414
415 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800416 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700417 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800418 */
419 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700420
421 /**
422 * Window type: secure system overlay windows, which need to be displayed
423 * on top of everything else. These windows must not take input
424 * focus, or they will interfere with the keyguard.
425 *
426 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
427 * system itself is allowed to create these overlays. Applications cannot
428 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700429 *
430 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700431 * @hide
432 */
433 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
434
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800435 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700436 * Window type: the drag-and-drop pseudowindow. There is only one
437 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700438 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700439 * @hide
440 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700441 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700442
443 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800444 * Window type: panel that slides out from under the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700445 * In multiuser systems shows on all users' windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800446 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800447 */
448 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
449
Jeff Brown83c09682010-12-23 17:50:18 -0800450 /**
451 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700452 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800453 * @hide
454 */
455 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800456
457 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400458 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700459 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400460 * @hide
461 */
462 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
463
464 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700465 * Window type: The volume level overlay/dialog shown when the user
466 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700467 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700468 * @hide
469 */
470 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
471
472 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700473 * Window type: The boot progress dialog, goes on top of everything
474 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700475 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700476 * @hide
477 */
478 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
479
480 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700481 * Window type: Fake window to consume touch events when the navigation
482 * bar is hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700483 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700484 * @hide
485 */
486 public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22;
487
488 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500489 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700490 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500491 * @hide
492 */
493 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
494
495 /**
Jim Millere898ac52012-04-06 17:10:57 -0700496 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700497 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700498 * @hide
499 */
500 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
501
502 /**
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700503 * Window type: Behind the universe of the real windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700504 * In multiuser systems shows on all users' windows.
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700505 * @hide
506 */
507 public static final int TYPE_UNIVERSE_BACKGROUND = FIRST_SYSTEM_WINDOW+25;
508
509 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700510 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700511 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700512 * @hide
513 */
514 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
515
516 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700517 * Window type: Magnification overlay window. Used to highlight the magnified
518 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -0700519 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700520 * @hide
521 */
522 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
523
524 /**
Craig Mautner88400d32012-09-30 12:35:45 -0700525 * Window type: Recents. Same layer as {@link #TYPE_SYSTEM_DIALOG} but only appears on
526 * one user's screen.
527 * In multiuser systems shows on all users' windows.
528 * @hide
529 */
530 public static final int TYPE_RECENTS_OVERLAY = FIRST_SYSTEM_WINDOW+28;
531
Jim Miller5ecd8112013-01-09 18:50:26 -0800532
533 /**
534 * Window type: keyguard scrim window. Shows if keyguard needs to be restarted.
535 * In multiuser systems shows on all users' windows.
536 * @hide
537 */
538 public static final int TYPE_KEYGUARD_SCRIM = FIRST_SYSTEM_WINDOW+29;
539
Craig Mautner88400d32012-09-30 12:35:45 -0700540 /**
keunyounga446bf02013-06-21 19:07:57 -0700541 * Window type: Window for Presentation on top of private
542 * virtual display.
543 */
544 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
545
546 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700547 * Window type: Windows in the voice interaction layer.
548 * @hide
549 */
550 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
551
552 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 * End of types of system windows.
554 */
555 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800556
Mathias Agopiand2112302010-12-07 19:38:17 -0800557 /** @deprecated this is ignored, this value is set automatically when needed. */
558 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800559 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800560 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700561 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800562 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800563 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700564 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800565 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800566 /** @deprecated this is ignored, this value is set automatically when needed. */
567 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800568 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000569
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800570 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700571 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800572 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700573 @Deprecated
574 public int memoryType;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000575
Mike Lockwoodef731622010-01-27 17:51:34 -0500576 /** Window flag: as long as this window is visible to the user, allow
Wonsik Kim475e3f02014-03-17 11:17:47 +0000577 * the lock screen to activate while the screen is on.
578 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800579 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500580 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
581
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800582 /** Window flag: everything behind this window will be dimmed.
583 * Use {@link #dimAmount} to control the amount of dim. */
584 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700585
586 /** Window flag: blur everything behind this window.
587 * @deprecated Blurring is no longer supported. */
588 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800589 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700590
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800591 /** Window flag: this window won't ever get key input focus, so the
592 * user can not send key or other button events to it. Those will
593 * instead go to whatever focusable window is behind it. This flag
594 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
595 * is explicitly set.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000596 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800597 * <p>Setting this flag also implies that the window will not need to
598 * interact with
Wonsik Kim475e3f02014-03-17 11:17:47 +0000599 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800600 * independently of any active input method (typically this means it
601 * gets Z-ordered on top of the input method, so it can use the full
602 * screen for its content and cover the input method if needed. You
603 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
604 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000605
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800606 /** Window flag: this window can never receive touch events. */
607 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000608
John Spurlock33291d82013-03-13 14:45:14 -0400609 /** Window flag: even when this window is focusable (its
610 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800611 * outside of the window to be sent to the windows behind it. Otherwise
612 * it will consume all pointer events itself, regardless of whether they
613 * are inside of the window. */
614 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000615
John Spurlock33291d82013-03-13 14:45:14 -0400616 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800617 * screen is pressed, you will receive this first touch event. Usually
618 * the first touch event is consumed by the system since the user can
619 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -0700620 *
621 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 */
Jeff Brown037c33e2014-04-09 00:31:55 -0700623 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800624 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000625
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800626 /** Window flag: as long as this window is visible to the user, keep
627 * the device's screen turned on and bright. */
628 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000629
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800630 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -0400631 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800632 * window must correctly position its contents to take the screen
633 * decoration into account. This flag is normally set for you
634 * by Window as described in {@link Window#setFlags}. */
635 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000636
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800637 /** Window flag: allow window to extend outside of the screen. */
638 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000639
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800640 /**
John Spurlock33291d82013-03-13 14:45:14 -0400641 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 * this window is displayed. This allows the window to use the entire
643 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -0700644 * an app window with this flag set is on the top layer. A fullscreen window
645 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
646 * {@link #softInputMode} field; the window will stay fullscreen
647 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800648 *
649 * <p>This flag can be controlled in your theme through the
650 * {@link android.R.attr#windowFullscreen} attribute; this attribute
651 * is automatically set for you in the standard fullscreen themes
652 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
653 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
654 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
655 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
656 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
657 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
658 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
659 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800660 public static final int FLAG_FULLSCREEN = 0x00000400;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000661
John Spurlock33291d82013-03-13 14:45:14 -0400662 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
663 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800664 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000665
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800666 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700667 * the screen.
668 * @deprecated This flag is no longer used. */
669 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 public static final int FLAG_DITHER = 0x00001000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000671
John Spurlock33291d82013-03-13 14:45:14 -0400672 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -0700673 * it from appearing in screenshots or from being viewed on non-secure
674 * displays.
675 *
676 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
677 * secure surfaces and secure displays.
678 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800679 public static final int FLAG_SECURE = 0x00002000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000680
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 /** Window flag: a special mode where the layout parameters are used
682 * to perform scaling of the surface when it is composited to the
683 * screen. */
684 public static final int FLAG_SCALED = 0x00004000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000685
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800686 /** Window flag: intended for windows that will often be used when the user is
687 * holding the screen against their face, it will aggressively filter the event
688 * stream to prevent unintended presses in this situation that may not be
Wonsik Kim475e3f02014-03-17 11:17:47 +0000689 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800690 * application will receive a CANCEL motion event to indicate this so applications
Wonsik Kim475e3f02014-03-17 11:17:47 +0000691 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800692 * until the finger is released. */
693 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000694
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800695 /** Window flag: a special option only for use in combination with
696 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
697 * screen your window may appear on top of or behind screen decorations
698 * such as the status bar. By also including this flag, the window
699 * manager will report the inset rectangle needed to ensure your
700 * content is not covered by screen decorations. This flag is normally
701 * set for you by Window as described in {@link Window#setFlags}.*/
702 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000703
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
705 * respect to how this window interacts with the current method. That
706 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
707 * window will behave as if it needs to interact with the input method
708 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
709 * not set and this flag is set, then the window will behave as if it
710 * doesn't need to interact with the input method and can be placed
711 * to use more space and cover the input method.
712 */
713 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000714
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800715 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
716 * can set this flag to receive a single special MotionEvent with
717 * the action
718 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
719 * touches that occur outside of your window. Note that you will not
720 * receive the full down/move/up gesture, only the location of the
721 * first down as an ACTION_OUTSIDE.
722 */
723 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000724
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700725 /** Window flag: special flag to let windows be shown when the screen
726 * is locked. This will let application windows take precedence over
727 * key guard or any other lock screens. Can be used with
728 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700729 * directly before showing the key guard window. Can be used with
730 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
731 * non-secure keyguards. This flag only applies to the top-most
732 * full-screen window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700733 */
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700734 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
735
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700736 /** Window flag: ask that the system wallpaper be shown behind
737 * your window. The window surface must be translucent to be able
738 * to actually see the wallpaper behind it; this flag just ensures
739 * that the wallpaper surface will be there if this window actually
740 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800741 *
742 * <p>This flag can be controlled in your theme through the
743 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
744 * is automatically set for you in the standard wallpaper themes
745 * such as {@link android.R.style#Theme_Wallpaper},
746 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
747 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
748 * {@link android.R.style#Theme_Holo_Wallpaper},
749 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
750 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
751 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700752 */
753 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000754
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700755 /** Window flag: when set as a window is being added or made
756 * visible, once the window has been shown then the system will
757 * poke the power manager's user activity (as if the user had woken
758 * up the device) to turn the screen on. */
759 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000760
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700761 /** Window flag: when set the window will cause the keyguard to
762 * be dismissed, only if it is not a secure lock keyguard. Because such
763 * a keyguard is not needed for security, it will never re-appear if
764 * the user navigates to another window (in contrast to
765 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
766 * hide both secure and non-secure keyguards but ensure they reappear
767 * when the user moves to another UI that doesn't hide them).
768 * If the keyguard is currently active and is secure (requires an
769 * unlock pattern) than the user will still need to confirm it before
770 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
Daniel Sandlerae069f72010-06-17 21:56:26 -0400771 * also been set.
772 */
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700773 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000774
Jeff Brown01ce2e92010-09-26 22:20:12 -0700775 /** Window flag: when set the window will accept for touch events
776 * outside of its bounds to be sent to other windows that also
777 * support split touch. When this flag is not set, the first pointer
778 * that goes down determines the window to which all subsequent touches
779 * go until all pointers go up. When this flag is set, each pointer
780 * (not necessarily the first) that goes down determines the window
781 * to which all subsequent touches of that pointer will go until that
782 * pointer goes up thereby enabling touches with multiple pointers
783 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800784 */
Jeff Brown01ce2e92010-09-26 22:20:12 -0700785 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000786
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800787 /**
Romain Guy72f0a272011-01-09 16:01:46 -0800788 * <p>Indicates whether this window should be hardware accelerated.
789 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800790 *
Romain Guy72f0a272011-01-09 16:01:46 -0800791 * <p>This flag can be controlled programmatically <em>only</em> to enable
792 * hardware acceleration. To enable hardware acceleration for a given
793 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800794 *
Romain Guy72f0a272011-01-09 16:01:46 -0800795 * <pre>
796 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
797 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
798 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
799 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800800 *
Romain Guy72f0a272011-01-09 16:01:46 -0800801 * <p>It is important to remember that this flag <strong>must</strong>
802 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800803 *
Romain Guy72f0a272011-01-09 16:01:46 -0800804 * <p>This flag cannot be used to disable hardware acceleration after it
805 * was enabled in your manifest using
806 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
807 * and programmatically disable hardware acceleration (for automated testing
808 * for instance), make sure it is turned off in your manifest and enable it
809 * on your activity or dialog when you need it instead, using the method
810 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800811 *
Romain Guy72f0a272011-01-09 16:01:46 -0800812 * <p>This flag is automatically set by the system if the
813 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
814 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800815 */
816 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -0400817
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800818 /**
819 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -0800820 * overscan area, if there is one. The window should still correctly
821 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800822 *
823 * <p>This flag can be controlled in your theme through the
824 * {@link android.R.attr#windowOverscan} attribute; this attribute
825 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -0700826 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800827 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
828 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
829 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
830 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
831 *
832 * <p>When this flag is enabled for a window, its normal content may be obscured
833 * to some degree by the overscan region of the display. To ensure key parts of
834 * that content are visible to the user, you can use
835 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
836 * to set the point in the view hierarchy where the appropriate offsets should
837 * be applied. (This can be done either by directly calling this function, using
838 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
839 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
840 * View.fitSystemWindows(Rect)} method).</p>
841 *
842 * <p>This mechanism for positioning content elements is identical to its equivalent
843 * use with layout and {@link View#setSystemUiVisibility(int)
844 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
845 * position its UI elements with this overscan flag is set:</p>
846 *
847 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -0800848 */
849 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
850
John Spurlockbd957402013-10-03 11:38:39 -0400851 /**
852 * Window flag: request a translucent status bar with minimal system-provided
853 * background protection.
854 *
855 * <p>This flag can be controlled in your theme through the
856 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
857 * is automatically set for you in the standard translucent decor themes
858 * such as
859 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
860 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
861 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
862 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
863 *
864 * <p>When this flag is enabled for a window, it automatically sets
865 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
866 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
867 */
868 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
869
870 /**
871 * Window flag: request a translucent navigation bar with minimal system-provided
872 * background protection.
873 *
874 * <p>This flag can be controlled in your theme through the
875 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
876 * is automatically set for you in the standard translucent decor themes
877 * such as
878 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
879 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
880 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
881 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
882 *
883 * <p>When this flag is enabled for a window, it automatically sets
884 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
885 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
886 */
887 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
888
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800889 // ----- HIDDEN FLAGS.
890 // These start at the high bit and go down.
Jeff Brown98db5fa2011-06-08 15:37:10 -0700891
Adam Lesinski6a591f52013-10-01 18:11:17 -0700892 /**
893 * Flag for a window in local focus mode.
894 * Window in local focus mode can control focus independent of window manager using
895 * {@link Window#setLocalFocus(boolean, boolean)}.
896 * Usually window in this mode will not get touch/key events from window manager, but will
897 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
898 */
899 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
900
Jeff Brown98db5fa2011-06-08 15:37:10 -0700901 /** Window flag: Enable touches to slide out of a window into neighboring
902 * windows in mid-gesture instead of being captured for the duration of
903 * the gesture.
904 *
905 * This flag changes the behavior of touch focus for this window only.
906 * Touches can slide out of the window but they cannot necessarily slide
907 * back in (unless the other window with touch focus permits it).
908 *
909 * {@hide}
910 */
Adam Lesinski6a591f52013-10-01 18:11:17 -0700911 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -0700912
Daniel Sandlere02d8082010-10-08 15:13:22 -0400913 /**
914 * Flag for a window belonging to an activity that responds to {@link KeyEvent#KEYCODE_MENU}
915 * and therefore needs a Menu key. For devices where Menu is a physical button this flag is
916 * ignored, but on devices where the Menu key is drawn in software it may be hidden unless
917 * this flag is set.
918 *
919 * (Note that Action Bars, when available, are the preferred way to offer additional
920 * functions otherwise accessed via an options menu.)
921 *
922 * {@hide}
923 */
Adam Lesinski6a591f52013-10-01 18:11:17 -0700924 public static final int FLAG_NEEDS_MENU_KEY = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -0400925
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 /**
Adrian Roos217ccd22014-05-09 14:29:04 +0200927 * Flag indicating that this Window is responsible for drawing the background for the
928 * system bars. If set, the system bars are drawn with a transparent background and the
929 * corresponding areas in this window are filled with the colors specified in
930 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
931 */
932 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
933
934 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700935 * Various behavioral options/flags. Default is none.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000936 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700937 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
938 * @see #FLAG_DIM_BEHIND
939 * @see #FLAG_NOT_FOCUSABLE
940 * @see #FLAG_NOT_TOUCHABLE
941 * @see #FLAG_NOT_TOUCH_MODAL
942 * @see #FLAG_TOUCHABLE_WHEN_WAKING
943 * @see #FLAG_KEEP_SCREEN_ON
944 * @see #FLAG_LAYOUT_IN_SCREEN
945 * @see #FLAG_LAYOUT_NO_LIMITS
946 * @see #FLAG_FULLSCREEN
947 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700948 * @see #FLAG_SECURE
949 * @see #FLAG_SCALED
950 * @see #FLAG_IGNORE_CHEEK_PRESSES
951 * @see #FLAG_LAYOUT_INSET_DECOR
952 * @see #FLAG_ALT_FOCUSABLE_IM
953 * @see #FLAG_WATCH_OUTSIDE_TOUCH
954 * @see #FLAG_SHOW_WHEN_LOCKED
955 * @see #FLAG_SHOW_WALLPAPER
956 * @see #FLAG_TURN_SCREEN_ON
957 * @see #FLAG_DISMISS_KEYGUARD
958 * @see #FLAG_SPLIT_TOUCH
959 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -0700960 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +0200961 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700962 */
963 @ViewDebug.ExportedProperty(flagMapping = {
964 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
965 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
966 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
967 name = "FLAG_DIM_BEHIND"),
968 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
969 name = "FLAG_BLUR_BEHIND"),
970 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
971 name = "FLAG_NOT_FOCUSABLE"),
972 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
973 name = "FLAG_NOT_TOUCHABLE"),
974 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
975 name = "FLAG_NOT_TOUCH_MODAL"),
976 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
977 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
978 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
979 name = "FLAG_KEEP_SCREEN_ON"),
980 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
981 name = "FLAG_LAYOUT_IN_SCREEN"),
982 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
983 name = "FLAG_LAYOUT_NO_LIMITS"),
984 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
985 name = "FLAG_FULLSCREEN"),
986 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
987 name = "FLAG_FORCE_NOT_FULLSCREEN"),
988 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
989 name = "FLAG_DITHER"),
990 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
991 name = "FLAG_SECURE"),
992 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
993 name = "FLAG_SCALED"),
994 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
995 name = "FLAG_IGNORE_CHEEK_PRESSES"),
996 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
997 name = "FLAG_LAYOUT_INSET_DECOR"),
998 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
999 name = "FLAG_ALT_FOCUSABLE_IM"),
1000 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
1001 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
1002 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
1003 name = "FLAG_SHOW_WHEN_LOCKED"),
1004 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
1005 name = "FLAG_SHOW_WALLPAPER"),
1006 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
1007 name = "FLAG_TURN_SCREEN_ON"),
1008 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
1009 name = "FLAG_DISMISS_KEYGUARD"),
1010 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
1011 name = "FLAG_SPLIT_TOUCH"),
1012 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
keunyoung30f420f2013-08-02 14:23:10 -07001013 name = "FLAG_HARDWARE_ACCELERATED"),
1014 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
John Spurlockbd957402013-10-03 11:38:39 -04001015 name = "FLAG_LOCAL_FOCUS_MODE"),
1016 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
1017 name = "FLAG_TRANSLUCENT_STATUS"),
1018 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Adrian Roos217ccd22014-05-09 14:29:04 +02001019 name = "FLAG_TRANSLUCENT_NAVIGATION"),
1020 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
1021 name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001022 })
1023 public int flags;
1024
1025 /**
1026 * If the window has requested hardware acceleration, but this is not
1027 * allowed in the process it is in, then still render it as if it is
1028 * hardware accelerated. This is used for the starting preview windows
1029 * in the system process, which don't need to have the overhead of
1030 * hardware acceleration (they are just a static rendering), but should
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001031 * be rendered as such to match the actual window of the app even if it
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001032 * is hardware accelerated.
1033 * Even if the window isn't hardware accelerated, still do its rendering
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001034 * as if it was.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001035 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1036 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
Wonsik Kim475e3f02014-03-17 11:17:47 +00001037 * is generally disabled. This flag must be specified in addition to
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001038 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1039 * windows.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001040 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001041 * @hide
1042 */
1043 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1044
1045 /**
1046 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001047 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001048 * If certain parts of the UI that really do want to use hardware
1049 * acceleration, this flag can be set to force it. This is basically
1050 * for the lock screen. Anyone else using it, you are probably wrong.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001051 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001052 * @hide
1053 */
1054 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1055
1056 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001057 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001058 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001059 * them (they do not affect the wallpaper scrolling operation) by calling
1060 * {@link
1061 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1062 *
1063 * @hide
1064 */
1065 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1066
1067 /**
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001068 * This is set for a window that has explicitly specified its
1069 * FLAG_NEEDS_MENU_KEY, so we know the value on this window is the
1070 * appropriate one to use. If this is not set, we should look at
1071 * windows behind it to determine the appropriate value.
1072 *
1073 * @hide
1074 */
1075 public static final int PRIVATE_FLAG_SET_NEEDS_MENU_KEY = 0x00000008;
1076
Craig Mautner88400d32012-09-30 12:35:45 -07001077 /** In a multiuser system if this flag is set and the owner is a system process then this
1078 * window will appear on all user screens. This overrides the default behavior of window
1079 * types that normally only appear on the owning user's screen. Refer to each window type
1080 * to determine its default behavior.
1081 *
1082 * {@hide} */
1083 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1084
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001085 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001086 * Never animate position changes of the window.
1087 *
1088 * {@hide} */
1089 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1090
Adam Lesinski6a591f52013-10-01 18:11:17 -07001091 /** Window flag: special flag to limit the size of the window to be
1092 * original size ([320x480] x density). Used to create window for applications
1093 * running under compatibility mode.
1094 *
1095 * {@hide} */
1096 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1097
1098 /** Window flag: a special option intended for system dialogs. When
1099 * this flag is set, the window will demand focus unconditionally when
1100 * it is created.
1101 * {@hide} */
1102 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1103
John Spurlock3f7cd512013-10-07 12:25:09 -04001104 /** Window flag: maintain the previous translucent decor state when this window
John Spurlockbd957402013-10-03 11:38:39 -04001105 * becomes top-most.
1106 * {@hide} */
1107 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
1108
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001109 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001110 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1111 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1112 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1113 * {@hide}
1114 */
1115 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1116
1117 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001118 * Control flags that are private to the platform.
1119 * @hide
1120 */
1121 public int privateFlags;
1122
1123 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001124 * Given a particular set of window manager flags, determine whether
1125 * such a window may be a target for an input method when it has
1126 * focus. In particular, this checks the
1127 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1128 * flags and returns true if the combination of the two corresponds
1129 * to a window that needs to be behind the input method so that the
1130 * user can type into it.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001131 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001132 * @param flags The current window manager flags.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001133 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001134 * @return Returns true if such a window should be behind/interact
1135 * with an input method, false if not.
1136 */
1137 public static boolean mayUseInputMethod(int flags) {
1138 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
1139 case 0:
1140 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
1141 return true;
1142 }
1143 return false;
1144 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001145
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001146 /**
1147 * Mask for {@link #softInputMode} of the bits that determine the
1148 * desired visibility state of the soft input area for this window.
1149 */
1150 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 /**
1153 * Visibility state for {@link #softInputMode}: no state has been specified.
1154 */
1155 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001156
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001157 /**
1158 * Visibility state for {@link #softInputMode}: please don't change the state of
1159 * the soft input area.
1160 */
1161 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001163 /**
1164 * Visibility state for {@link #softInputMode}: please hide any soft input
1165 * area when normally appropriate (when the user is navigating
1166 * forward to your window).
1167 */
1168 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001169
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001170 /**
1171 * Visibility state for {@link #softInputMode}: please always hide any
1172 * soft input area when this window receives focus.
1173 */
1174 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001175
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001176 /**
1177 * Visibility state for {@link #softInputMode}: please show the soft
1178 * input area when normally appropriate (when the user is navigating
1179 * forward to your window).
1180 */
1181 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001182
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001183 /**
1184 * Visibility state for {@link #softInputMode}: please always make the
1185 * soft input area visible when this window receives input focus.
1186 */
1187 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001188
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001189 /**
1190 * Mask for {@link #softInputMode} of the bits that determine the
1191 * way that the window should be adjusted to accommodate the soft
1192 * input window.
1193 */
1194 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001195
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 /** Adjustment option for {@link #softInputMode}: nothing specified.
1197 * The system will try to pick one or
1198 * the other depending on the contents of the window.
1199 */
1200 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001201
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 /** Adjustment option for {@link #softInputMode}: set to allow the
1203 * window to be resized when an input
1204 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07001205 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 * {@link #SOFT_INPUT_ADJUST_PAN}; if
1207 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07001208 * the other depending on the contents of the window. If the window's
1209 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
1210 * value for {@link #softInputMode} will be ignored; the window will
1211 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001212 */
1213 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001214
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 /** Adjustment option for {@link #softInputMode}: set to have a window
1216 * pan when an input method is
1217 * shown, so it doesn't need to deal with resizing but just panned
1218 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07001219 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001220 * neither of these are set, then the system will try to pick one or
1221 * the other depending on the contents of the window.
1222 */
1223 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001224
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001225 /** Adjustment option for {@link #softInputMode}: set to have a window
1226 * not adjust for a shown input method. The window will not be resized,
1227 * and it will not be panned to make its focus visible.
1228 */
1229 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
1230
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 /**
1232 * Bit for {@link #softInputMode}: set when the user has navigated
1233 * forward to the window. This is normally set automatically for
1234 * you by the system, though you may want to set it in certain cases
1235 * when you are displaying a window yourself. This flag will always
1236 * be cleared automatically after the window is displayed.
1237 */
1238 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001239
1240 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08001241 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001242 * of:
Wonsik Kim475e3f02014-03-17 11:17:47 +00001243 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001244 * <ul>
1245 * <li> One of the visibility states
1246 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
1247 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or
1248 * {@link #SOFT_INPUT_STATE_VISIBLE}.
1249 * <li> One of the adjustment options
1250 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},
1251 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or
1252 * {@link #SOFT_INPUT_ADJUST_PAN}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001253 * </ul>
1254 *
1255 *
1256 * <p>This flag can be controlled in your theme through the
1257 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001258 */
1259 public int softInputMode;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001260
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001261 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001262 * Placement of window within the screen as per {@link Gravity}. Both
1263 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1264 * android.graphics.Rect) Gravity.apply} and
1265 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1266 * Gravity.applyDisplay} are used during window layout, with this value
1267 * given as the desired gravity. For example you can specify
1268 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
1269 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
1270 * to control the behavior of
1271 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1272 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 *
1274 * @see Gravity
1275 */
1276 public int gravity;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001277
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 /**
1279 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001280 * between the container and the widget. See
1281 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1282 * android.graphics.Rect) Gravity.apply} for how this is used. This
1283 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001284 */
1285 public float horizontalMargin;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001286
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001287 /**
1288 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001289 * between the container and the widget. See
1290 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1291 * android.graphics.Rect) Gravity.apply} for how this is used. This
1292 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001293 */
1294 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001295
1296 /**
1297 * Positive insets between the drawing surface and window content.
1298 *
1299 * @hide
1300 */
1301 public Rect shadowInsets = new Rect();
Wonsik Kim475e3f02014-03-17 11:17:47 +00001302
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001303 /**
1304 * The desired bitmap format. May be one of the constants in
1305 * {@link android.graphics.PixelFormat}. Default is OPAQUE.
1306 */
1307 public int format;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001308
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 /**
1310 * A style resource defining the animations to use for this window.
1311 * This must be a system resource; it can not be an application resource
1312 * because the window manager does not have access to applications.
1313 */
1314 public int windowAnimations;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001316 /**
1317 * An alpha value to apply to this entire window.
1318 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1319 */
1320 public float alpha = 1.0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001321
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001322 /**
1323 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1324 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1325 * dim.
1326 */
1327 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001328
1329 /**
1330 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1331 * indicating that the brightness value is not overridden for this window
1332 * and normal brightness policy should be used.
1333 */
1334 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1335
1336 /**
1337 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1338 * indicating that the screen or button backlight brightness should be set
1339 * to the lowest value when this window is in front.
1340 */
1341 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1342
1343 /**
1344 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1345 * indicating that the screen or button backlight brightness should be set
1346 * to the hightest value when this window is in front.
1347 */
1348 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001349
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001350 /**
1351 * This can be used to override the user's preferred brightness of
1352 * the screen. A value of less than 0, the default, means to use the
1353 * preferred screen brightness. 0 to 1 adjusts the brightness from
1354 * dark to full bright.
1355 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001356 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001357
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001359 * This can be used to override the standard behavior of the button and
1360 * keyboard backlights. A value of less than 0, the default, means to
1361 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1362 * from dark to full bright.
1363 */
1364 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1365
1366 /**
Craig Mautner3c174372013-02-21 17:54:37 -08001367 * Value for {@link #rotationAnimation} to define the animation used to
1368 * specify that this window will rotate in or out following a rotation.
1369 */
1370 public static final int ROTATION_ANIMATION_ROTATE = 0;
1371
1372 /**
1373 * Value for {@link #rotationAnimation} to define the animation used to
1374 * specify that this window will fade in or out following a rotation.
1375 */
1376 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
1377
1378 /**
1379 * Value for {@link #rotationAnimation} to define the animation used to
1380 * specify that this window will immediately disappear or appear following
1381 * a rotation.
1382 */
1383 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
1384
1385 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001386 * Define the exit and entry animations used on this window when the device is rotated.
1387 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08001388 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001389 * by other windows. All other situations default to the
1390 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001391 *
Craig Mautner3c174372013-02-21 17:54:37 -08001392 * @see #ROTATION_ANIMATION_ROTATE
1393 * @see #ROTATION_ANIMATION_CROSSFADE
1394 * @see #ROTATION_ANIMATION_JUMPCUT
1395 */
1396 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
1397
1398 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001399 * Identifier for this window. This will usually be filled in for
1400 * you.
1401 */
1402 public IBinder token = null;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001403
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001404 /**
1405 * Name of the package owning this window.
1406 */
1407 public String packageName = null;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001408
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001409 /**
1410 * Specific orientation value for a window.
1411 * May be any of the same values allowed
Wonsik Kim475e3f02014-03-17 11:17:47 +00001412 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1413 * If not set, a default value of
1414 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001415 * will be used.
1416 */
1417 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001418
1419 /**
1420 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001421 *
1422 * @see View#STATUS_BAR_VISIBLE
1423 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001424 */
1425 public int systemUiVisibility;
1426
1427 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001428 * @hide
1429 * The ui visibility as requested by the views in this hierarchy.
1430 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1431 */
1432 public int subtreeSystemUiVisibility;
1433
1434 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001435 * Get callbacks about the system ui visibility changing.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001436 *
Joe Onorato664644d2011-01-23 17:53:23 -08001437 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1438 *
1439 * @hide
1440 */
1441 public boolean hasSystemUiListeners;
1442
Jeff Brown474dcb52011-06-14 20:22:50 -07001443 /**
1444 * When this window has focus, disable touch pad pointer gesture processing.
1445 * The window will receive raw position updates from the touch pad instead
1446 * of pointer movements and synthetic touch events.
1447 *
1448 * @hide
1449 */
1450 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1451
1452 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001453 * Does not construct an input channel for this window. The channel will therefore
1454 * be incapable of receiving input.
1455 *
1456 * @hide
1457 */
1458 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1459
1460 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001461 * When this window has focus, does not call user activity for all input events so
1462 * the application will have to do it itself. Should only be used by
1463 * the keyguard and phone app.
1464 * <p>
1465 * Should only be used by the keyguard and phone app.
1466 * </p>
1467 *
1468 * @hide
1469 */
1470 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
1471
1472 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001473 * Control special features of the input subsystem.
1474 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001475 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001476 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001477 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07001478 * @hide
1479 */
1480 public int inputFeatures;
1481
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001482 /**
1483 * Sets the number of milliseconds before the user activity timeout occurs
1484 * when this window has focus. A value of -1 uses the standard timeout.
1485 * A value of 0 uses the minimum support display timeout.
1486 * <p>
1487 * This property can only be used to reduce the user specified display timeout;
1488 * it can never make the timeout longer than it normally would be.
1489 * </p><p>
1490 * Should only be used by the keyguard and phone app.
1491 * </p>
1492 *
1493 * @hide
1494 */
1495 public long userActivityTimeout = -1;
1496
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001497 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001498 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001499 type = TYPE_APPLICATION;
1500 format = PixelFormat.OPAQUE;
1501 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001502
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001503 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001504 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001505 type = _type;
1506 format = PixelFormat.OPAQUE;
1507 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001508
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001509 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001510 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001511 type = _type;
1512 flags = _flags;
1513 format = PixelFormat.OPAQUE;
1514 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001515
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001516 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08001517 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001518 type = _type;
1519 flags = _flags;
1520 format = _format;
1521 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001522
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001523 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
1524 super(w, h);
1525 type = _type;
1526 flags = _flags;
1527 format = _format;
1528 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001529
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001530 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
1531 int _flags, int _format) {
1532 super(w, h);
1533 x = xpos;
1534 y = ypos;
1535 type = _type;
1536 flags = _flags;
1537 format = _format;
1538 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001539
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001540 public final void setTitle(CharSequence title) {
1541 if (null == title)
1542 title = "";
Wonsik Kim475e3f02014-03-17 11:17:47 +00001543
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001544 mTitle = TextUtils.stringOrSpannedString(title);
1545 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001546
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001547 public final CharSequence getTitle() {
1548 return mTitle;
1549 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001550
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001551 public int describeContents() {
1552 return 0;
1553 }
1554
1555 public void writeToParcel(Parcel out, int parcelableFlags) {
1556 out.writeInt(width);
1557 out.writeInt(height);
1558 out.writeInt(x);
1559 out.writeInt(y);
1560 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001561 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001562 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001563 out.writeInt(softInputMode);
1564 out.writeInt(gravity);
1565 out.writeFloat(horizontalMargin);
1566 out.writeFloat(verticalMargin);
1567 out.writeInt(format);
1568 out.writeInt(windowAnimations);
1569 out.writeFloat(alpha);
1570 out.writeFloat(dimAmount);
1571 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001572 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08001573 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001574 out.writeStrongBinder(token);
1575 out.writeString(packageName);
1576 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
1577 out.writeInt(screenOrientation);
Joe Onorato664644d2011-01-23 17:53:23 -08001578 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08001579 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08001580 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07001581 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001582 out.writeLong(userActivityTimeout);
Alan Viveretteccb11e12014-07-08 16:04:02 -07001583 out.writeInt(shadowInsets.left);
1584 out.writeInt(shadowInsets.top);
1585 out.writeInt(shadowInsets.right);
1586 out.writeInt(shadowInsets.bottom);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001587 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001588
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001589 public static final Parcelable.Creator<LayoutParams> CREATOR
1590 = new Parcelable.Creator<LayoutParams>() {
1591 public LayoutParams createFromParcel(Parcel in) {
1592 return new LayoutParams(in);
1593 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001594
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001595 public LayoutParams[] newArray(int size) {
1596 return new LayoutParams[size];
1597 }
1598 };
Wonsik Kim475e3f02014-03-17 11:17:47 +00001599
1600
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001601 public LayoutParams(Parcel in) {
1602 width = in.readInt();
1603 height = in.readInt();
1604 x = in.readInt();
1605 y = in.readInt();
1606 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001607 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001608 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001609 softInputMode = in.readInt();
1610 gravity = in.readInt();
1611 horizontalMargin = in.readFloat();
1612 verticalMargin = in.readFloat();
1613 format = in.readInt();
1614 windowAnimations = in.readInt();
1615 alpha = in.readFloat();
1616 dimAmount = in.readFloat();
1617 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001618 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08001619 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001620 token = in.readStrongBinder();
1621 packageName = in.readString();
1622 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
1623 screenOrientation = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001624 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08001625 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001626 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07001627 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001628 userActivityTimeout = in.readLong();
Alan Viveretteccb11e12014-07-08 16:04:02 -07001629 shadowInsets.set(in.readInt(), in.readInt(), in.readInt(), in.readInt());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001630 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001631
Romain Guy72998072009-06-22 11:09:20 -07001632 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001633 public static final int LAYOUT_CHANGED = 1<<0;
1634 public static final int TYPE_CHANGED = 1<<1;
1635 public static final int FLAGS_CHANGED = 1<<2;
1636 public static final int FORMAT_CHANGED = 1<<3;
1637 public static final int ANIMATION_CHANGED = 1<<4;
1638 public static final int DIM_AMOUNT_CHANGED = 1<<5;
1639 public static final int TITLE_CHANGED = 1<<6;
1640 public static final int ALPHA_CHANGED = 1<<7;
1641 public static final int MEMORY_TYPE_CHANGED = 1<<8;
1642 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
1643 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
1644 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08001645 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001646 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001647 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08001648 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001649 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08001650 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001651 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07001652 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001653 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001654 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001655 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07001656 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001657 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001658 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04001659 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
1660 /** {@hide} */
Alan Viveretteccb11e12014-07-08 16:04:02 -07001661 public static final int SHADOW_INSETS_CHANGED = 1<<20;
1662 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07001663 public static final int EVERYTHING_CHANGED = 0xffffffff;
1664
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001665 // internal buffer to backup/restore parameters under compatibility mode.
1666 private int[] mCompatibilityParamsBackup = null;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001667
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001668 public final int copyFrom(LayoutParams o) {
1669 int changes = 0;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001670
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001671 if (width != o.width) {
1672 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07001673 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001674 }
1675 if (height != o.height) {
1676 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07001677 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001678 }
1679 if (x != o.x) {
1680 x = o.x;
1681 changes |= LAYOUT_CHANGED;
1682 }
1683 if (y != o.y) {
1684 y = o.y;
1685 changes |= LAYOUT_CHANGED;
1686 }
1687 if (horizontalWeight != o.horizontalWeight) {
1688 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001689 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001690 }
1691 if (verticalWeight != o.verticalWeight) {
1692 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001693 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001694 }
1695 if (horizontalMargin != o.horizontalMargin) {
1696 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001697 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001698 }
1699 if (verticalMargin != o.verticalMargin) {
1700 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001701 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001702 }
1703 if (type != o.type) {
1704 type = o.type;
1705 changes |= TYPE_CHANGED;
1706 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001707 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04001708 final int diff = flags ^ o.flags;
1709 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
1710 changes |= TRANSLUCENT_FLAGS_CHANGED;
1711 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001712 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07001713 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001714 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001715 if (privateFlags != o.privateFlags) {
1716 privateFlags = o.privateFlags;
1717 changes |= PRIVATE_FLAGS_CHANGED;
1718 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001719 if (softInputMode != o.softInputMode) {
1720 softInputMode = o.softInputMode;
1721 changes |= SOFT_INPUT_MODE_CHANGED;
1722 }
1723 if (gravity != o.gravity) {
1724 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07001725 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001726 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001727 if (format != o.format) {
1728 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07001729 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001730 }
1731 if (windowAnimations != o.windowAnimations) {
1732 windowAnimations = o.windowAnimations;
1733 changes |= ANIMATION_CHANGED;
1734 }
1735 if (token == null) {
1736 // NOTE: token only copied if the recipient doesn't
1737 // already have one.
1738 token = o.token;
1739 }
1740 if (packageName == null) {
1741 // NOTE: packageName only copied if the recipient doesn't
1742 // already have one.
1743 packageName = o.packageName;
1744 }
1745 if (!mTitle.equals(o.mTitle)) {
1746 mTitle = o.mTitle;
1747 changes |= TITLE_CHANGED;
1748 }
1749 if (alpha != o.alpha) {
1750 alpha = o.alpha;
1751 changes |= ALPHA_CHANGED;
1752 }
1753 if (dimAmount != o.dimAmount) {
1754 dimAmount = o.dimAmount;
1755 changes |= DIM_AMOUNT_CHANGED;
1756 }
1757 if (screenBrightness != o.screenBrightness) {
1758 screenBrightness = o.screenBrightness;
1759 changes |= SCREEN_BRIGHTNESS_CHANGED;
1760 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001761 if (buttonBrightness != o.buttonBrightness) {
1762 buttonBrightness = o.buttonBrightness;
1763 changes |= BUTTON_BRIGHTNESS_CHANGED;
1764 }
Craig Mautner3c174372013-02-21 17:54:37 -08001765 if (rotationAnimation != o.rotationAnimation) {
1766 rotationAnimation = o.rotationAnimation;
1767 changes |= ROTATION_ANIMATION_CHANGED;
1768 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001769
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001770 if (screenOrientation != o.screenOrientation) {
1771 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07001772 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001773 }
Romain Guy529b60a2010-08-03 18:05:47 -07001774
Joe Onorato14782f72011-01-25 19:53:17 -08001775 if (systemUiVisibility != o.systemUiVisibility
1776 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08001777 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08001778 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08001779 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
1780 }
1781
1782 if (hasSystemUiListeners != o.hasSystemUiListeners) {
1783 hasSystemUiListeners = o.hasSystemUiListeners;
1784 changes |= SYSTEM_UI_LISTENER_CHANGED;
1785 }
1786
Jeff Brown474dcb52011-06-14 20:22:50 -07001787 if (inputFeatures != o.inputFeatures) {
1788 inputFeatures = o.inputFeatures;
1789 changes |= INPUT_FEATURES_CHANGED;
1790 }
1791
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001792 if (userActivityTimeout != o.userActivityTimeout) {
1793 userActivityTimeout = o.userActivityTimeout;
1794 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
1795 }
1796
Alan Viveretteccb11e12014-07-08 16:04:02 -07001797 if (!shadowInsets.equals(o.shadowInsets)) {
1798 shadowInsets.set(o.shadowInsets);
1799 changes |= SHADOW_INSETS_CHANGED;
1800 }
1801
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001802 return changes;
1803 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001804
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001805 @Override
1806 public String debug(String output) {
1807 output += "Contents of " + this + ":";
1808 Log.d("Debug", output);
1809 output = super.debug("");
1810 Log.d("Debug", output);
1811 Log.d("Debug", "");
1812 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
1813 return "";
1814 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001815
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001816 @Override
1817 public String toString() {
1818 StringBuilder sb = new StringBuilder(256);
1819 sb.append("WM.LayoutParams{");
1820 sb.append("(");
1821 sb.append(x);
1822 sb.append(',');
1823 sb.append(y);
1824 sb.append(")(");
Romain Guy980a9382010-01-08 15:06:28 -08001825 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001826 sb.append('x');
Romain Guy980a9382010-01-08 15:06:28 -08001827 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001828 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001829 if (horizontalMargin != 0) {
1830 sb.append(" hm=");
1831 sb.append(horizontalMargin);
1832 }
1833 if (verticalMargin != 0) {
1834 sb.append(" vm=");
1835 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001836 }
1837 if (gravity != 0) {
1838 sb.append(" gr=#");
1839 sb.append(Integer.toHexString(gravity));
1840 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001841 if (softInputMode != 0) {
1842 sb.append(" sim=#");
1843 sb.append(Integer.toHexString(softInputMode));
1844 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001845 sb.append(" ty=");
1846 sb.append(type);
1847 sb.append(" fl=#");
1848 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001849 if (privateFlags != 0) {
Adam Lesinski95c42972013-10-02 10:13:27 -07001850 if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
1851 sb.append(" compatible=true");
1852 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001853 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
1854 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001855 if (format != PixelFormat.OPAQUE) {
1856 sb.append(" fmt=");
1857 sb.append(format);
1858 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001859 if (windowAnimations != 0) {
1860 sb.append(" wanim=0x");
1861 sb.append(Integer.toHexString(windowAnimations));
1862 }
1863 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
1864 sb.append(" or=");
1865 sb.append(screenOrientation);
1866 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001867 if (alpha != 1.0f) {
1868 sb.append(" alpha=");
1869 sb.append(alpha);
1870 }
1871 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1872 sb.append(" sbrt=");
1873 sb.append(screenBrightness);
1874 }
1875 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1876 sb.append(" bbrt=");
1877 sb.append(buttonBrightness);
1878 }
Craig Mautner3c174372013-02-21 17:54:37 -08001879 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
1880 sb.append(" rotAnim=");
1881 sb.append(rotationAnimation);
1882 }
Joe Onorato664644d2011-01-23 17:53:23 -08001883 if (systemUiVisibility != 0) {
1884 sb.append(" sysui=0x");
1885 sb.append(Integer.toHexString(systemUiVisibility));
1886 }
Joe Onorato14782f72011-01-25 19:53:17 -08001887 if (subtreeSystemUiVisibility != 0) {
1888 sb.append(" vsysui=0x");
1889 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
1890 }
Joe Onorato664644d2011-01-23 17:53:23 -08001891 if (hasSystemUiListeners) {
1892 sb.append(" sysuil=");
1893 sb.append(hasSystemUiListeners);
1894 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001895 if (inputFeatures != 0) {
1896 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
1897 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001898 if (userActivityTimeout >= 0) {
1899 sb.append(" userActivityTimeout=").append(userActivityTimeout);
1900 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07001901 if (!shadowInsets.equals(Insets.NONE)) {
1902 sb.append(" shadowInsets=").append(shadowInsets);
1903 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001904 sb.append('}');
1905 return sb.toString();
1906 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001907
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001908 /**
1909 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001910 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001911 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001912 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001913 x = (int) (x * scale + 0.5f);
1914 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001915 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001916 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001917 }
1918 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001919 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001920 }
1921 }
1922
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001923 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001924 * Backup the layout parameters used in compatibility mode.
1925 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001926 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001927 void backup() {
1928 int[] backup = mCompatibilityParamsBackup;
1929 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001930 // we backup 4 elements, x, y, width, height
1931 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001932 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001933 backup[0] = x;
1934 backup[1] = y;
1935 backup[2] = width;
1936 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001937 }
1938
1939 /**
1940 * Restore the layout params' coordinates, size and gravity
1941 * @see LayoutParams#backup()
1942 */
1943 void restore() {
1944 int[] backup = mCompatibilityParamsBackup;
1945 if (backup != null) {
1946 x = backup[0];
1947 y = backup[1];
1948 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001949 height = backup[3];
1950 }
1951 }
1952
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001953 private CharSequence mTitle = "";
1954 }
1955}