blob: 84434f7e07aac00eda5a2f1b4288cc5e31d7ef62 [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
Bryce Lee53b9fbd2015-02-06 12:06:34 -080019import android.annotation.SystemApi;
Jeff Browna492c3a2012-08-23 19:48:44 -070020import android.app.Presentation;
21import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.pm.ActivityInfo;
Alan Viveretteccb11e12014-07-08 16:04:02 -070023import android.graphics.Insets;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.graphics.PixelFormat;
Alan Viveretteccb11e12014-07-08 16:04:02 -070025import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.os.IBinder;
27import android.os.Parcel;
28import android.os.Parcelable;
29import android.text.TextUtils;
30import android.util.Log;
31
32
33/**
34 * The interface that apps use to talk to the window manager.
35 * <p>
36 * Use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> to get one of these.
Jeff Browna492c3a2012-08-23 19:48:44 -070037 * </p><p>
38 * Each window manager instance is bound to a particular {@link Display}.
39 * To obtain a {@link WindowManager} for a different display, use
40 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
41 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
42 * to get the WindowManager.
43 * </p><p>
44 * The simplest way to show a window on another display is to create a
45 * {@link Presentation}. The presentation will automatically obtain a
46 * {@link WindowManager} and {@link Context} for that display.
47 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048 *
49 * @see android.content.Context#getSystemService
50 * @see android.content.Context#WINDOW_SERVICE
51 */
52public interface WindowManager extends ViewManager {
53 /**
54 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +010055 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 * is invalid.
57 */
58 public static class BadTokenException extends RuntimeException {
59 public BadTokenException() {
60 }
61
62 public BadTokenException(String name) {
63 super(name);
64 }
65 }
66
67 /**
Craig Mautner6018aee2012-10-23 14:27:49 -070068 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
69 * be found. See {@link android.app.Presentation} for more information on secondary displays.
70 */
71 public static class InvalidDisplayException extends RuntimeException {
72 public InvalidDisplayException() {
73 }
74
75 public InvalidDisplayException(String name) {
76 super(name);
77 }
78 }
79
80 /**
Jeff Browna492c3a2012-08-23 19:48:44 -070081 * Returns the {@link Display} upon which this {@link WindowManager} instance
82 * will create new windows.
83 * <p>
84 * Despite the name of this method, the display that is returned is not
85 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
86 * The returned display could instead be a secondary display that this
87 * window manager instance is managing. Think of it as the display that
88 * this {@link WindowManager} instance uses by default.
89 * </p><p>
90 * To create windows on a different display, you need to obtain a
91 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
92 * class documentation for more information.)
93 * </p>
94 *
95 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 */
97 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -070098
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 /**
100 * Special variation of {@link #removeView} that immediately invokes
101 * the given view hierarchy's {@link View#onDetachedFromWindow()
102 * View.onDetachedFromWindow()} methods before returning. This is not
103 * for normal applications; using it correctly requires great care.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000104 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 * @param view The view to be removed.
106 */
107 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700108
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 public static class LayoutParams extends ViewGroup.LayoutParams
110 implements Parcelable {
111 /**
112 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700113 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
114 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 */
Romain Guy529b60a2010-08-03 18:05:47 -0700116 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 public int x;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000118
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800119 /**
120 * Y position for this window. With the default gravity it is ignored.
121 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
122 * an offset from the given edge.
123 */
Romain Guy529b60a2010-08-03 18:05:47 -0700124 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800125 public int y;
126
127 /**
128 * Indicates how much of the extra space will be allocated horizontally
129 * to the view associated with these LayoutParams. Specify 0 if the view
130 * should not be stretched. Otherwise the extra pixels will be pro-rated
131 * among all views whose weight is greater than 0.
132 */
Romain Guy529b60a2010-08-03 18:05:47 -0700133 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 public float horizontalWeight;
135
136 /**
137 * Indicates how much of the extra space will be allocated vertically
138 * to the view associated with these LayoutParams. Specify 0 if the view
139 * should not be stretched. Otherwise the extra pixels will be pro-rated
140 * among all views whose weight is greater than 0.
141 */
Romain Guy529b60a2010-08-03 18:05:47 -0700142 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700144
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800145 /**
146 * The general type of window. There are three main classes of
147 * window types:
148 * <ul>
149 * <li> <strong>Application windows</strong> (ranging from
150 * {@link #FIRST_APPLICATION_WINDOW} to
151 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
152 * windows. For these types of windows, the {@link #token} must be
153 * set to the token of the activity they are a part of (this will
154 * normally be done for you if {@link #token} is null).
155 * <li> <strong>Sub-windows</strong> (ranging from
156 * {@link #FIRST_SUB_WINDOW} to
157 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
158 * window. For these types of windows, the {@link #token} must be
159 * the token of the window it is attached to.
160 * <li> <strong>System windows</strong> (ranging from
161 * {@link #FIRST_SYSTEM_WINDOW} to
162 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
163 * use by the system for specific purposes. They should not normally
164 * be used by applications, and a special permission is required
165 * to use them.
166 * </ul>
Wonsik Kim475e3f02014-03-17 11:17:47 +0000167 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800168 * @see #TYPE_BASE_APPLICATION
169 * @see #TYPE_APPLICATION
170 * @see #TYPE_APPLICATION_STARTING
171 * @see #TYPE_APPLICATION_PANEL
172 * @see #TYPE_APPLICATION_MEDIA
173 * @see #TYPE_APPLICATION_SUB_PANEL
174 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
175 * @see #TYPE_STATUS_BAR
176 * @see #TYPE_SEARCH_BAR
177 * @see #TYPE_PHONE
178 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800179 * @see #TYPE_TOAST
180 * @see #TYPE_SYSTEM_OVERLAY
181 * @see #TYPE_PRIORITY_PHONE
182 * @see #TYPE_STATUS_BAR_PANEL
183 * @see #TYPE_SYSTEM_DIALOG
184 * @see #TYPE_KEYGUARD_DIALOG
185 * @see #TYPE_SYSTEM_ERROR
186 * @see #TYPE_INPUT_METHOD
187 * @see #TYPE_INPUT_METHOD_DIALOG
188 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700189 @ViewDebug.ExportedProperty(mapping = {
190 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
191 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
192 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
193 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
194 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
195 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
196 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700197 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700198 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
199 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
200 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
201 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700202 @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
203 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
204 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700205 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"),
206 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
207 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
208 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
Jeff Brown3b2b3542010-10-15 00:54:27 -0700209 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700210 @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
211 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700212 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700213 @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
214 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
215 @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
216 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
217 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700218 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
219 @ViewDebug.IntToString(from = TYPE_HIDDEN_NAV_CONSUMER, to = "TYPE_HIDDEN_NAV_CONSUMER"),
220 @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
Jeff Brownbd6e1502012-08-28 03:27:37 -0700221 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"),
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700222 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"),
keunyounga446bf02013-06-21 19:07:57 -0700223 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY"),
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700224 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION"),
225 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, to = "TYPE_VOICE_INTERACTION"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700226 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800227 public int type;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000228
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800229 /**
230 * Start of window types that represent normal application windows.
231 */
232 public static final int FIRST_APPLICATION_WINDOW = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800234 /**
235 * Window type: an application window that serves as the "base" window
236 * of the overall application; all other application windows will
237 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700238 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239 */
240 public static final int TYPE_BASE_APPLICATION = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000241
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800242 /**
243 * Window type: a normal application window. The {@link #token} must be
244 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700245 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800246 */
247 public static final int TYPE_APPLICATION = 2;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800249 /**
250 * Window type: special application window that is displayed while the
251 * application is starting. Not for use by applications themselves;
252 * this is used by the system to display something until the
253 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700254 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 */
256 public static final int TYPE_APPLICATION_STARTING = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800258 /**
259 * End of types of application windows.
260 */
261 public static final int LAST_APPLICATION_WINDOW = 99;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000262
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800263 /**
264 * Start of types of sub-windows. The {@link #token} of these windows
265 * must be set to the window they are attached to. These types of
266 * windows are kept next to their attached window in Z-order, and their
267 * coordinate space is relative to their attached window.
268 */
269 public static final int FIRST_SUB_WINDOW = 1000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000270
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800271 /**
272 * Window type: a panel on top of an application window. These windows
273 * appear on top of their attached window.
274 */
275 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000276
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800277 /**
John Spurlock33291d82013-03-13 14:45:14 -0400278 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800279 * are displayed behind their attached window.
280 */
281 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000282
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 /**
284 * Window type: a sub-panel on top of an application window. These
285 * windows are displayed on top their attached window and any
286 * {@link #TYPE_APPLICATION_PANEL} panels.
287 */
288 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW+2;
289
290 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
291 * of the window happens as that of a top-level window, <em>not</em>
292 * as a child of its container.
293 */
294 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000295
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800296 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700297 * Window type: window for showing overlays on top of media windows.
298 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
299 * application window. They should be translucent to be useful. This
300 * is a big ugly hack so:
301 * @hide
302 */
303 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000304
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700305 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306 * End of types of sub-windows.
307 */
308 public static final int LAST_SUB_WINDOW = 1999;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000309
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800310 /**
311 * Start of system-specific window types. These are not normally
312 * created by applications.
313 */
314 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 /**
317 * Window type: the status bar. There can be only one status bar
318 * window; it is placed at the top of the screen, and all other
319 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700320 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800321 */
322 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000323
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800324 /**
325 * Window type: the search bar. There can be only one search bar
326 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700327 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800328 */
329 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000330
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800331 /**
332 * Window type: phone. These are non-application windows providing
333 * user interaction with the phone (in particular incoming calls).
334 * These windows are normally placed above all applications, but behind
335 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700336 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800337 */
338 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800340 /**
341 * Window type: system window, such as low power alert. These windows
342 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700343 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344 */
345 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100346
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347 /**
348 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700349 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200350 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 */
352 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100353
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 /**
355 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700356 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800357 */
358 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000359
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800360 /**
361 * Window type: system overlay windows, which need to be displayed
362 * on top of everything else. These windows must not take input
363 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700364 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800365 */
366 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000367
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800368 /**
369 * Window type: priority phone UI, which needs to be displayed even if
370 * the keyguard is active. These windows must not take input
371 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700372 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800373 */
374 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000375
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800376 /**
377 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700378 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800379 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000381
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800382 /**
383 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700384 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 */
386 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000387
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800388 /**
389 * Window type: internal system error windows, appear on top of
390 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700391 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 */
393 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000394
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800395 /**
396 * Window type: internal input methods windows, which appear above
397 * the normal UI. Application windows may be resized or panned to keep
398 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700399 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 */
401 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
402
403 /**
404 * Window type: internal input methods dialog windows, which appear above
405 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700406 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800407 */
408 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
409
410 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700411 * Window type: wallpaper window, placed behind any window that wants
412 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700413 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700414 */
415 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
416
417 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800418 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700419 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800420 */
421 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700422
423 /**
424 * Window type: secure system overlay windows, which need to be displayed
425 * on top of everything else. These windows must not take input
426 * focus, or they will interfere with the keyguard.
427 *
428 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
429 * system itself is allowed to create these overlays. Applications cannot
430 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700431 *
432 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700433 * @hide
434 */
435 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
436
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800437 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700438 * Window type: the drag-and-drop pseudowindow. There is only one
439 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700440 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700441 * @hide
442 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700443 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700444
445 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800446 * Window type: panel that slides out from under the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700447 * In multiuser systems shows on all users' windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800448 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800449 */
450 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
451
Jeff Brown83c09682010-12-23 17:50:18 -0800452 /**
453 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700454 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800455 * @hide
456 */
457 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800458
459 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400460 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700461 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400462 * @hide
463 */
464 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
465
466 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700467 * Window type: The volume level overlay/dialog shown when the user
468 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700469 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700470 * @hide
471 */
472 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
473
474 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700475 * Window type: The boot progress dialog, goes on top of everything
476 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700477 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700478 * @hide
479 */
480 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
481
482 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700483 * Window type: Fake window to consume touch events when the navigation
484 * bar is hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700485 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700486 * @hide
487 */
488 public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22;
489
490 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500491 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700492 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500493 * @hide
494 */
495 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
496
497 /**
Jim Millere898ac52012-04-06 17:10:57 -0700498 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700499 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700500 * @hide
501 */
502 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
503
504 /**
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700505 * Window type: Behind the universe of the real windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700506 * In multiuser systems shows on all users' windows.
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700507 * @hide
508 */
509 public static final int TYPE_UNIVERSE_BACKGROUND = FIRST_SYSTEM_WINDOW+25;
510
511 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700512 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700513 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700514 * @hide
515 */
516 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
517
518 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700519 * Window type: Magnification overlay window. Used to highlight the magnified
520 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -0700521 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700522 * @hide
523 */
524 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
525
526 /**
Jim Miller5ecd8112013-01-09 18:50:26 -0800527 * Window type: keyguard scrim window. Shows if keyguard needs to be restarted.
528 * In multiuser systems shows on all users' windows.
529 * @hide
530 */
531 public static final int TYPE_KEYGUARD_SCRIM = FIRST_SYSTEM_WINDOW+29;
532
Craig Mautner88400d32012-09-30 12:35:45 -0700533 /**
keunyounga446bf02013-06-21 19:07:57 -0700534 * Window type: Window for Presentation on top of private
535 * virtual display.
536 */
537 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
538
539 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700540 * Window type: Windows in the voice interaction layer.
541 * @hide
542 */
543 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
544
545 /**
Svetoslav3a5c7212014-10-14 09:54:26 -0700546 * Window type: Windows that are overlaid <em>only</em> by an {@link
547 * android.accessibilityservice.AccessibilityService} for interception of
548 * user interactions without changing the windows an accessibility service
549 * can introspect. In particular, an accessibility service can introspect
550 * only windows that a sighted user can interact with which is they can touch
551 * these windows or can type into these windows. For example, if there
552 * is a full screen accessibility overlay that is touchable, the windows
553 * below it will be introspectable by an accessibility service regardless
554 * they are covered by a touchable window.
555 */
556 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
557
558 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800559 * End of types of system windows.
560 */
561 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800562
Mathias Agopiand2112302010-12-07 19:38:17 -0800563 /** @deprecated this is ignored, this value is set automatically when needed. */
564 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800565 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800566 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700567 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800568 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800569 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700570 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800571 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800572 /** @deprecated this is ignored, this value is set automatically when needed. */
573 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800574 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000575
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800576 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700577 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700579 @Deprecated
580 public int memoryType;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000581
Mike Lockwoodef731622010-01-27 17:51:34 -0500582 /** Window flag: as long as this window is visible to the user, allow
Wonsik Kim475e3f02014-03-17 11:17:47 +0000583 * the lock screen to activate while the screen is on.
584 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800585 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500586 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
587
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800588 /** Window flag: everything behind this window will be dimmed.
589 * Use {@link #dimAmount} to control the amount of dim. */
590 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700591
592 /** Window flag: blur everything behind this window.
593 * @deprecated Blurring is no longer supported. */
594 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800595 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700596
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800597 /** Window flag: this window won't ever get key input focus, so the
598 * user can not send key or other button events to it. Those will
599 * instead go to whatever focusable window is behind it. This flag
600 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
601 * is explicitly set.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000602 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800603 * <p>Setting this flag also implies that the window will not need to
604 * interact with
Wonsik Kim475e3f02014-03-17 11:17:47 +0000605 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800606 * independently of any active input method (typically this means it
607 * gets Z-ordered on top of the input method, so it can use the full
608 * screen for its content and cover the input method if needed. You
609 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
610 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000611
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800612 /** Window flag: this window can never receive touch events. */
613 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000614
John Spurlock33291d82013-03-13 14:45:14 -0400615 /** Window flag: even when this window is focusable (its
616 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800617 * outside of the window to be sent to the windows behind it. Otherwise
618 * it will consume all pointer events itself, regardless of whether they
619 * are inside of the window. */
620 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000621
John Spurlock33291d82013-03-13 14:45:14 -0400622 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 * screen is pressed, you will receive this first touch event. Usually
624 * the first touch event is consumed by the system since the user can
625 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -0700626 *
627 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800628 */
Jeff Brown037c33e2014-04-09 00:31:55 -0700629 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800630 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000631
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800632 /** Window flag: as long as this window is visible to the user, keep
633 * the device's screen turned on and bright. */
634 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000635
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800636 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -0400637 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800638 * window must correctly position its contents to take the screen
639 * decoration into account. This flag is normally set for you
640 * by Window as described in {@link Window#setFlags}. */
641 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000642
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800643 /** Window flag: allow window to extend outside of the screen. */
644 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000645
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800646 /**
John Spurlock33291d82013-03-13 14:45:14 -0400647 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 * this window is displayed. This allows the window to use the entire
649 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -0700650 * an app window with this flag set is on the top layer. A fullscreen window
651 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
652 * {@link #softInputMode} field; the window will stay fullscreen
653 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800654 *
655 * <p>This flag can be controlled in your theme through the
656 * {@link android.R.attr#windowFullscreen} attribute; this attribute
657 * is automatically set for you in the standard fullscreen themes
658 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
659 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
660 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
661 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
662 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
663 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
664 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
665 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800666 public static final int FLAG_FULLSCREEN = 0x00000400;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000667
John Spurlock33291d82013-03-13 14:45:14 -0400668 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
669 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000671
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800672 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700673 * the screen.
674 * @deprecated This flag is no longer used. */
675 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800676 public static final int FLAG_DITHER = 0x00001000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000677
John Spurlock33291d82013-03-13 14:45:14 -0400678 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -0700679 * it from appearing in screenshots or from being viewed on non-secure
680 * displays.
681 *
682 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
683 * secure surfaces and secure displays.
684 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800685 public static final int FLAG_SECURE = 0x00002000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000686
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800687 /** Window flag: a special mode where the layout parameters are used
688 * to perform scaling of the surface when it is composited to the
689 * screen. */
690 public static final int FLAG_SCALED = 0x00004000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000691
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800692 /** Window flag: intended for windows that will often be used when the user is
693 * holding the screen against their face, it will aggressively filter the event
694 * stream to prevent unintended presses in this situation that may not be
Wonsik Kim475e3f02014-03-17 11:17:47 +0000695 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800696 * application will receive a CANCEL motion event to indicate this so applications
Wonsik Kim475e3f02014-03-17 11:17:47 +0000697 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 * until the finger is released. */
699 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000700
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 /** Window flag: a special option only for use in combination with
702 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
703 * screen your window may appear on top of or behind screen decorations
704 * such as the status bar. By also including this flag, the window
705 * manager will report the inset rectangle needed to ensure your
706 * content is not covered by screen decorations. This flag is normally
707 * set for you by Window as described in {@link Window#setFlags}.*/
708 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
711 * respect to how this window interacts with the current method. That
712 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
713 * window will behave as if it needs to interact with the input method
714 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
715 * not set and this flag is set, then the window will behave as if it
716 * doesn't need to interact with the input method and can be placed
717 * to use more space and cover the input method.
718 */
719 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
722 * can set this flag to receive a single special MotionEvent with
723 * the action
724 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
725 * touches that occur outside of your window. Note that you will not
726 * receive the full down/move/up gesture, only the location of the
727 * first down as an ACTION_OUTSIDE.
728 */
729 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000730
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700731 /** Window flag: special flag to let windows be shown when the screen
732 * is locked. This will let application windows take precedence over
733 * key guard or any other lock screens. Can be used with
734 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700735 * directly before showing the key guard window. Can be used with
736 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
737 * non-secure keyguards. This flag only applies to the top-most
738 * full-screen window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700739 */
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700740 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
741
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700742 /** Window flag: ask that the system wallpaper be shown behind
743 * your window. The window surface must be translucent to be able
744 * to actually see the wallpaper behind it; this flag just ensures
745 * that the wallpaper surface will be there if this window actually
746 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800747 *
748 * <p>This flag can be controlled in your theme through the
749 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
750 * is automatically set for you in the standard wallpaper themes
751 * such as {@link android.R.style#Theme_Wallpaper},
752 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
753 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
754 * {@link android.R.style#Theme_Holo_Wallpaper},
755 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
756 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
757 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700758 */
759 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000760
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700761 /** Window flag: when set as a window is being added or made
762 * visible, once the window has been shown then the system will
763 * poke the power manager's user activity (as if the user had woken
764 * up the device) to turn the screen on. */
765 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000766
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700767 /** Window flag: when set the window will cause the keyguard to
768 * be dismissed, only if it is not a secure lock keyguard. Because such
769 * a keyguard is not needed for security, it will never re-appear if
770 * the user navigates to another window (in contrast to
771 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
772 * hide both secure and non-secure keyguards but ensure they reappear
773 * when the user moves to another UI that doesn't hide them).
774 * If the keyguard is currently active and is secure (requires an
775 * unlock pattern) than the user will still need to confirm it before
776 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
Daniel Sandlerae069f72010-06-17 21:56:26 -0400777 * also been set.
778 */
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700779 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000780
Jeff Brown01ce2e92010-09-26 22:20:12 -0700781 /** Window flag: when set the window will accept for touch events
782 * outside of its bounds to be sent to other windows that also
783 * support split touch. When this flag is not set, the first pointer
784 * that goes down determines the window to which all subsequent touches
785 * go until all pointers go up. When this flag is set, each pointer
786 * (not necessarily the first) that goes down determines the window
787 * to which all subsequent touches of that pointer will go until that
788 * pointer goes up thereby enabling touches with multiple pointers
789 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800790 */
Jeff Brown01ce2e92010-09-26 22:20:12 -0700791 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000792
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800793 /**
Romain Guy72f0a272011-01-09 16:01:46 -0800794 * <p>Indicates whether this window should be hardware accelerated.
795 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800796 *
Romain Guy72f0a272011-01-09 16:01:46 -0800797 * <p>This flag can be controlled programmatically <em>only</em> to enable
798 * hardware acceleration. To enable hardware acceleration for a given
799 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800800 *
Romain Guy72f0a272011-01-09 16:01:46 -0800801 * <pre>
802 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
803 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
804 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
805 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800806 *
Romain Guy72f0a272011-01-09 16:01:46 -0800807 * <p>It is important to remember that this flag <strong>must</strong>
808 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800809 *
Romain Guy72f0a272011-01-09 16:01:46 -0800810 * <p>This flag cannot be used to disable hardware acceleration after it
811 * was enabled in your manifest using
812 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
813 * and programmatically disable hardware acceleration (for automated testing
814 * for instance), make sure it is turned off in your manifest and enable it
815 * on your activity or dialog when you need it instead, using the method
816 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800817 *
Romain Guy72f0a272011-01-09 16:01:46 -0800818 * <p>This flag is automatically set by the system if the
819 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
820 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800821 */
822 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -0400823
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800824 /**
825 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -0800826 * overscan area, if there is one. The window should still correctly
827 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800828 *
829 * <p>This flag can be controlled in your theme through the
830 * {@link android.R.attr#windowOverscan} attribute; this attribute
831 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -0700832 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800833 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
834 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
835 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
836 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
837 *
838 * <p>When this flag is enabled for a window, its normal content may be obscured
839 * to some degree by the overscan region of the display. To ensure key parts of
840 * that content are visible to the user, you can use
841 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
842 * to set the point in the view hierarchy where the appropriate offsets should
843 * be applied. (This can be done either by directly calling this function, using
844 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
845 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
846 * View.fitSystemWindows(Rect)} method).</p>
847 *
848 * <p>This mechanism for positioning content elements is identical to its equivalent
849 * use with layout and {@link View#setSystemUiVisibility(int)
850 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
851 * position its UI elements with this overscan flag is set:</p>
852 *
853 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -0800854 */
855 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
856
John Spurlockbd957402013-10-03 11:38:39 -0400857 /**
858 * Window flag: request a translucent status bar with minimal system-provided
859 * background protection.
860 *
861 * <p>This flag can be controlled in your theme through the
862 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
863 * is automatically set for you in the standard translucent decor themes
864 * such as
865 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
866 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
867 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
868 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
869 *
870 * <p>When this flag is enabled for a window, it automatically sets
871 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
872 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
873 */
874 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
875
876 /**
877 * Window flag: request a translucent navigation bar with minimal system-provided
878 * background protection.
879 *
880 * <p>This flag can be controlled in your theme through the
881 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
882 * is automatically set for you in the standard translucent decor themes
883 * such as
884 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
885 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
886 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
887 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
888 *
889 * <p>When this flag is enabled for a window, it automatically sets
890 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
891 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
892 */
893 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
894
Adam Lesinski6a591f52013-10-01 18:11:17 -0700895 /**
896 * Flag for a window in local focus mode.
897 * Window in local focus mode can control focus independent of window manager using
898 * {@link Window#setLocalFocus(boolean, boolean)}.
899 * Usually window in this mode will not get touch/key events from window manager, but will
900 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
901 */
902 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
903
Jeff Brown98db5fa2011-06-08 15:37:10 -0700904 /** Window flag: Enable touches to slide out of a window into neighboring
905 * windows in mid-gesture instead of being captured for the duration of
906 * the gesture.
907 *
908 * This flag changes the behavior of touch focus for this window only.
909 * Touches can slide out of the window but they cannot necessarily slide
910 * back in (unless the other window with touch focus permits it).
911 *
912 * {@hide}
913 */
Adam Lesinski6a591f52013-10-01 18:11:17 -0700914 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -0700915
Daniel Sandlere02d8082010-10-08 15:13:22 -0400916 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -0700917 * Window flag: When requesting layout with an attached window, the attached window may
918 * overlap with the screen decorations of the parent window such as the navigation bar. By
919 * including this flag, the window manager will layout the attached window within the decor
920 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -0400921 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -0700922 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -0400923
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800924 /**
Adrian Roos217ccd22014-05-09 14:29:04 +0200925 * Flag indicating that this Window is responsible for drawing the background for the
926 * system bars. If set, the system bars are drawn with a transparent background and the
927 * corresponding areas in this window are filled with the colors specified in
928 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
929 */
930 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
931
932 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700933 * Various behavioral options/flags. Default is none.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000934 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700935 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
936 * @see #FLAG_DIM_BEHIND
937 * @see #FLAG_NOT_FOCUSABLE
938 * @see #FLAG_NOT_TOUCHABLE
939 * @see #FLAG_NOT_TOUCH_MODAL
940 * @see #FLAG_TOUCHABLE_WHEN_WAKING
941 * @see #FLAG_KEEP_SCREEN_ON
942 * @see #FLAG_LAYOUT_IN_SCREEN
943 * @see #FLAG_LAYOUT_NO_LIMITS
944 * @see #FLAG_FULLSCREEN
945 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700946 * @see #FLAG_SECURE
947 * @see #FLAG_SCALED
948 * @see #FLAG_IGNORE_CHEEK_PRESSES
949 * @see #FLAG_LAYOUT_INSET_DECOR
950 * @see #FLAG_ALT_FOCUSABLE_IM
951 * @see #FLAG_WATCH_OUTSIDE_TOUCH
952 * @see #FLAG_SHOW_WHEN_LOCKED
953 * @see #FLAG_SHOW_WALLPAPER
954 * @see #FLAG_TURN_SCREEN_ON
955 * @see #FLAG_DISMISS_KEYGUARD
956 * @see #FLAG_SPLIT_TOUCH
957 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -0700958 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +0200959 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700960 */
961 @ViewDebug.ExportedProperty(flagMapping = {
962 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
963 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
964 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
965 name = "FLAG_DIM_BEHIND"),
966 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
967 name = "FLAG_BLUR_BEHIND"),
968 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
969 name = "FLAG_NOT_FOCUSABLE"),
970 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
971 name = "FLAG_NOT_TOUCHABLE"),
972 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
973 name = "FLAG_NOT_TOUCH_MODAL"),
974 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
975 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
976 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
977 name = "FLAG_KEEP_SCREEN_ON"),
978 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
979 name = "FLAG_LAYOUT_IN_SCREEN"),
980 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
981 name = "FLAG_LAYOUT_NO_LIMITS"),
982 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
983 name = "FLAG_FULLSCREEN"),
984 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
985 name = "FLAG_FORCE_NOT_FULLSCREEN"),
986 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
987 name = "FLAG_DITHER"),
988 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
989 name = "FLAG_SECURE"),
990 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
991 name = "FLAG_SCALED"),
992 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
993 name = "FLAG_IGNORE_CHEEK_PRESSES"),
994 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
995 name = "FLAG_LAYOUT_INSET_DECOR"),
996 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
997 name = "FLAG_ALT_FOCUSABLE_IM"),
998 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
999 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
1000 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
1001 name = "FLAG_SHOW_WHEN_LOCKED"),
1002 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
1003 name = "FLAG_SHOW_WALLPAPER"),
1004 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
1005 name = "FLAG_TURN_SCREEN_ON"),
1006 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
1007 name = "FLAG_DISMISS_KEYGUARD"),
1008 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
1009 name = "FLAG_SPLIT_TOUCH"),
1010 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
keunyoung30f420f2013-08-02 14:23:10 -07001011 name = "FLAG_HARDWARE_ACCELERATED"),
1012 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
John Spurlockbd957402013-10-03 11:38:39 -04001013 name = "FLAG_LOCAL_FOCUS_MODE"),
1014 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
1015 name = "FLAG_TRANSLUCENT_STATUS"),
1016 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Adrian Roos217ccd22014-05-09 14:29:04 +02001017 name = "FLAG_TRANSLUCENT_NAVIGATION"),
1018 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
1019 name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001020 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001021 public int flags;
1022
1023 /**
John Reck61375a82014-09-18 19:27:48 +00001024 * If the window has requested hardware acceleration, but this is not
1025 * allowed in the process it is in, then still render it as if it is
1026 * hardware accelerated. This is used for the starting preview windows
1027 * in the system process, which don't need to have the overhead of
1028 * hardware acceleration (they are just a static rendering), but should
1029 * be rendered as such to match the actual window of the app even if it
1030 * is hardware accelerated.
1031 * Even if the window isn't hardware accelerated, still do its rendering
1032 * as if it was.
1033 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1034 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
1035 * is generally disabled. This flag must be specified in addition to
1036 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1037 * windows.
1038 *
1039 * @hide
1040 */
1041 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1042
1043 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001044 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001045 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001046 * If certain parts of the UI that really do want to use hardware
1047 * acceleration, this flag can be set to force it. This is basically
1048 * for the lock screen. Anyone else using it, you are probably wrong.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001049 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001050 * @hide
1051 */
1052 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1053
1054 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001055 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001056 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001057 * them (they do not affect the wallpaper scrolling operation) by calling
1058 * {@link
1059 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1060 *
1061 * @hide
1062 */
1063 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1064
Craig Mautner88400d32012-09-30 12:35:45 -07001065 /** In a multiuser system if this flag is set and the owner is a system process then this
1066 * window will appear on all user screens. This overrides the default behavior of window
1067 * types that normally only appear on the owning user's screen. Refer to each window type
1068 * to determine its default behavior.
1069 *
1070 * {@hide} */
1071 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1072
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001073 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001074 * Never animate position changes of the window.
1075 *
1076 * {@hide} */
1077 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1078
Adam Lesinski6a591f52013-10-01 18:11:17 -07001079 /** Window flag: special flag to limit the size of the window to be
1080 * original size ([320x480] x density). Used to create window for applications
1081 * running under compatibility mode.
1082 *
1083 * {@hide} */
1084 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1085
1086 /** Window flag: a special option intended for system dialogs. When
1087 * this flag is set, the window will demand focus unconditionally when
1088 * it is created.
1089 * {@hide} */
1090 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1091
John Spurlock3f7cd512013-10-07 12:25:09 -04001092 /** Window flag: maintain the previous translucent decor state when this window
John Spurlockbd957402013-10-03 11:38:39 -04001093 * becomes top-most.
1094 * {@hide} */
1095 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
1096
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001097 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001098 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1099 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1100 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1101 * {@hide}
1102 */
1103 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1104
1105 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001106 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1107 *
1108 * {@hide}
1109 */
1110 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1111
1112 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001113 * Control flags that are private to the platform.
1114 * @hide
1115 */
1116 public int privateFlags;
1117
1118 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001119 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1120 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1121 * key. For this case, we should look at windows behind it to determine the appropriate
1122 * value.
1123 *
1124 * @hide
1125 */
1126 public static final int NEEDS_MENU_UNSET = 0;
1127
1128 /**
1129 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1130 * menu key.
1131 *
1132 * @hide
1133 */
1134 public static final int NEEDS_MENU_SET_TRUE = 1;
1135
1136 /**
1137 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1138 * needs a menu key.
1139 *
1140 * @hide
1141 */
1142 public static final int NEEDS_MENU_SET_FALSE = 2;
1143
1144 /**
1145 * State variable for a window belonging to an activity that responds to
1146 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1147 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1148 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1149 *
1150 * (Note that Action Bars, when available, are the preferred way to offer additional
1151 * functions otherwise accessed via an options menu.)
1152 *
1153 * {@hide}
1154 */
1155 public int needsMenuKey = NEEDS_MENU_UNSET;
1156
1157 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001158 * Given a particular set of window manager flags, determine whether
1159 * such a window may be a target for an input method when it has
1160 * focus. In particular, this checks the
1161 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1162 * flags and returns true if the combination of the two corresponds
1163 * to a window that needs to be behind the input method so that the
1164 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001165 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001166 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001167 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001168 * @return Returns true if such a window should be behind/interact
1169 * with an input method, false if not.
1170 */
1171 public static boolean mayUseInputMethod(int flags) {
1172 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
1173 case 0:
1174 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
1175 return true;
1176 }
1177 return false;
1178 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001179
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001180 /**
1181 * Mask for {@link #softInputMode} of the bits that determine the
1182 * desired visibility state of the soft input area for this window.
1183 */
1184 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001185
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 /**
1187 * Visibility state for {@link #softInputMode}: no state has been specified.
1188 */
1189 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001190
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001191 /**
1192 * Visibility state for {@link #softInputMode}: please don't change the state of
1193 * the soft input area.
1194 */
1195 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001196
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001197 /**
1198 * Visibility state for {@link #softInputMode}: please hide any soft input
1199 * area when normally appropriate (when the user is navigating
1200 * forward to your window).
1201 */
1202 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001203
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204 /**
1205 * Visibility state for {@link #softInputMode}: please always hide any
1206 * soft input area when this window receives focus.
1207 */
1208 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001209
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001210 /**
1211 * Visibility state for {@link #softInputMode}: please show the soft
1212 * input area when normally appropriate (when the user is navigating
1213 * forward to your window).
1214 */
1215 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001216
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001217 /**
1218 * Visibility state for {@link #softInputMode}: please always make the
1219 * soft input area visible when this window receives input focus.
1220 */
1221 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001222
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 /**
1224 * Mask for {@link #softInputMode} of the bits that determine the
1225 * way that the window should be adjusted to accommodate the soft
1226 * input window.
1227 */
1228 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001229
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001230 /** Adjustment option for {@link #softInputMode}: nothing specified.
1231 * The system will try to pick one or
1232 * the other depending on the contents of the window.
1233 */
1234 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001235
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001236 /** Adjustment option for {@link #softInputMode}: set to allow the
1237 * window to be resized when an input
1238 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07001239 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 * {@link #SOFT_INPUT_ADJUST_PAN}; if
1241 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07001242 * the other depending on the contents of the window. If the window's
1243 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
1244 * value for {@link #softInputMode} will be ignored; the window will
1245 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001246 */
1247 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001249 /** Adjustment option for {@link #softInputMode}: set to have a window
1250 * pan when an input method is
1251 * shown, so it doesn't need to deal with resizing but just panned
1252 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07001253 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001254 * neither of these are set, then the system will try to pick one or
1255 * the other depending on the contents of the window.
1256 */
1257 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001258
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001259 /** Adjustment option for {@link #softInputMode}: set to have a window
1260 * not adjust for a shown input method. The window will not be resized,
1261 * and it will not be panned to make its focus visible.
1262 */
1263 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
1264
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001265 /**
1266 * Bit for {@link #softInputMode}: set when the user has navigated
1267 * forward to the window. This is normally set automatically for
1268 * you by the system, though you may want to set it in certain cases
1269 * when you are displaying a window yourself. This flag will always
1270 * be cleared automatically after the window is displayed.
1271 */
1272 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001273
1274 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08001275 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001276 * of:
Wonsik Kim475e3f02014-03-17 11:17:47 +00001277 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 * <ul>
1279 * <li> One of the visibility states
1280 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
1281 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or
1282 * {@link #SOFT_INPUT_STATE_VISIBLE}.
1283 * <li> One of the adjustment options
1284 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},
1285 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or
1286 * {@link #SOFT_INPUT_ADJUST_PAN}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001287 * </ul>
1288 *
1289 *
1290 * <p>This flag can be controlled in your theme through the
1291 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001292 */
1293 public int softInputMode;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001294
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001295 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001296 * Placement of window within the screen as per {@link Gravity}. Both
1297 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1298 * android.graphics.Rect) Gravity.apply} and
1299 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1300 * Gravity.applyDisplay} are used during window layout, with this value
1301 * given as the desired gravity. For example you can specify
1302 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
1303 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
1304 * to control the behavior of
1305 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1306 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001307 *
1308 * @see Gravity
1309 */
1310 public int gravity;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001311
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001312 /**
1313 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001314 * between the container and the widget. See
1315 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1316 * android.graphics.Rect) Gravity.apply} for how this is used. This
1317 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 */
1319 public float horizontalMargin;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001320
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001321 /**
1322 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001323 * between the container and the widget. See
1324 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1325 * android.graphics.Rect) Gravity.apply} for how this is used. This
1326 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001327 */
1328 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001329
1330 /**
1331 * Positive insets between the drawing surface and window content.
1332 *
1333 * @hide
1334 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07001335 public final Rect surfaceInsets = new Rect();
Wonsik Kim475e3f02014-03-17 11:17:47 +00001336
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001337 /**
1338 * The desired bitmap format. May be one of the constants in
1339 * {@link android.graphics.PixelFormat}. Default is OPAQUE.
1340 */
1341 public int format;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001342
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001343 /**
1344 * A style resource defining the animations to use for this window.
1345 * This must be a system resource; it can not be an application resource
1346 * because the window manager does not have access to applications.
1347 */
1348 public int windowAnimations;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001349
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001350 /**
1351 * An alpha value to apply to this entire window.
1352 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1353 */
1354 public float alpha = 1.0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001355
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001356 /**
1357 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1358 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1359 * dim.
1360 */
1361 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001362
1363 /**
1364 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1365 * indicating that the brightness value is not overridden for this window
1366 * and normal brightness policy should be used.
1367 */
1368 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1369
1370 /**
1371 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1372 * indicating that the screen or button backlight brightness should be set
1373 * to the lowest value when this window is in front.
1374 */
1375 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1376
1377 /**
1378 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1379 * indicating that the screen or button backlight brightness should be set
1380 * to the hightest value when this window is in front.
1381 */
1382 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001383
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 /**
1385 * This can be used to override the user's preferred brightness of
1386 * the screen. A value of less than 0, the default, means to use the
1387 * preferred screen brightness. 0 to 1 adjusts the brightness from
1388 * dark to full bright.
1389 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001390 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001391
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001392 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001393 * This can be used to override the standard behavior of the button and
1394 * keyboard backlights. A value of less than 0, the default, means to
1395 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1396 * from dark to full bright.
1397 */
1398 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1399
1400 /**
Craig Mautner3c174372013-02-21 17:54:37 -08001401 * Value for {@link #rotationAnimation} to define the animation used to
1402 * specify that this window will rotate in or out following a rotation.
1403 */
1404 public static final int ROTATION_ANIMATION_ROTATE = 0;
1405
1406 /**
1407 * Value for {@link #rotationAnimation} to define the animation used to
1408 * specify that this window will fade in or out following a rotation.
1409 */
1410 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
1411
1412 /**
1413 * Value for {@link #rotationAnimation} to define the animation used to
1414 * specify that this window will immediately disappear or appear following
1415 * a rotation.
1416 */
1417 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
1418
1419 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001420 * Define the exit and entry animations used on this window when the device is rotated.
1421 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08001422 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001423 * by other windows. All other situations default to the
1424 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001425 *
Craig Mautner3c174372013-02-21 17:54:37 -08001426 * @see #ROTATION_ANIMATION_ROTATE
1427 * @see #ROTATION_ANIMATION_CROSSFADE
1428 * @see #ROTATION_ANIMATION_JUMPCUT
1429 */
1430 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
1431
1432 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001433 * Identifier for this window. This will usually be filled in for
1434 * you.
1435 */
1436 public IBinder token = null;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001437
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001438 /**
1439 * Name of the package owning this window.
1440 */
1441 public String packageName = null;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001442
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001443 /**
1444 * Specific orientation value for a window.
1445 * May be any of the same values allowed
Wonsik Kim475e3f02014-03-17 11:17:47 +00001446 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1447 * If not set, a default value of
1448 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001449 * will be used.
1450 */
1451 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001452
1453 /**
Michael Wright3f145a22014-07-22 19:46:03 -07001454 * The preferred refresh rate for the window.
1455 *
1456 * This must be one of the supported refresh rates obtained for the display(s) the window
1457 * is on.
1458 *
1459 * @see Display#getSupportedRefreshRates()
1460 */
1461 public float preferredRefreshRate;
1462
1463 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001464 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001465 *
1466 * @see View#STATUS_BAR_VISIBLE
1467 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001468 */
1469 public int systemUiVisibility;
1470
1471 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001472 * @hide
1473 * The ui visibility as requested by the views in this hierarchy.
1474 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1475 */
1476 public int subtreeSystemUiVisibility;
1477
1478 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001479 * Get callbacks about the system ui visibility changing.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001480 *
Joe Onorato664644d2011-01-23 17:53:23 -08001481 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1482 *
1483 * @hide
1484 */
1485 public boolean hasSystemUiListeners;
1486
Jeff Brown474dcb52011-06-14 20:22:50 -07001487 /**
1488 * When this window has focus, disable touch pad pointer gesture processing.
1489 * The window will receive raw position updates from the touch pad instead
1490 * of pointer movements and synthetic touch events.
1491 *
1492 * @hide
1493 */
1494 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1495
1496 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001497 * Does not construct an input channel for this window. The channel will therefore
1498 * be incapable of receiving input.
1499 *
1500 * @hide
1501 */
1502 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1503
1504 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001505 * When this window has focus, does not call user activity for all input events so
1506 * the application will have to do it itself. Should only be used by
1507 * the keyguard and phone app.
1508 * <p>
1509 * Should only be used by the keyguard and phone app.
1510 * </p>
1511 *
1512 * @hide
1513 */
1514 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
1515
1516 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001517 * Control special features of the input subsystem.
1518 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001519 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001520 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001521 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07001522 * @hide
1523 */
1524 public int inputFeatures;
1525
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001526 /**
1527 * Sets the number of milliseconds before the user activity timeout occurs
1528 * when this window has focus. A value of -1 uses the standard timeout.
1529 * A value of 0 uses the minimum support display timeout.
1530 * <p>
1531 * This property can only be used to reduce the user specified display timeout;
1532 * it can never make the timeout longer than it normally would be.
1533 * </p><p>
1534 * Should only be used by the keyguard and phone app.
1535 * </p>
1536 *
1537 * @hide
1538 */
1539 public long userActivityTimeout = -1;
1540
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001541 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001542 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001543 type = TYPE_APPLICATION;
1544 format = PixelFormat.OPAQUE;
1545 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001546
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001547 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001548 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001549 type = _type;
1550 format = PixelFormat.OPAQUE;
1551 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001552
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001553 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001554 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001555 type = _type;
1556 flags = _flags;
1557 format = PixelFormat.OPAQUE;
1558 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001559
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001560 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08001561 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001562 type = _type;
1563 flags = _flags;
1564 format = _format;
1565 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001566
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001567 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
1568 super(w, h);
1569 type = _type;
1570 flags = _flags;
1571 format = _format;
1572 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001573
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001574 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
1575 int _flags, int _format) {
1576 super(w, h);
1577 x = xpos;
1578 y = ypos;
1579 type = _type;
1580 flags = _flags;
1581 format = _format;
1582 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001583
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001584 public final void setTitle(CharSequence title) {
1585 if (null == title)
1586 title = "";
Wonsik Kim475e3f02014-03-17 11:17:47 +00001587
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001588 mTitle = TextUtils.stringOrSpannedString(title);
1589 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001590
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001591 public final CharSequence getTitle() {
1592 return mTitle;
1593 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08001594
1595 /** @hide */
1596 @SystemApi
1597 public final void setUserActivityTimeout(long timeout) {
1598 userActivityTimeout = timeout;
1599 }
1600
1601 /** @hide */
1602 @SystemApi
1603 public final long getUserActivityTimeout() {
1604 return userActivityTimeout;
1605 }
1606
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001607 public int describeContents() {
1608 return 0;
1609 }
1610
1611 public void writeToParcel(Parcel out, int parcelableFlags) {
1612 out.writeInt(width);
1613 out.writeInt(height);
1614 out.writeInt(x);
1615 out.writeInt(y);
1616 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001617 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001618 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001619 out.writeInt(softInputMode);
1620 out.writeInt(gravity);
1621 out.writeFloat(horizontalMargin);
1622 out.writeFloat(verticalMargin);
1623 out.writeInt(format);
1624 out.writeInt(windowAnimations);
1625 out.writeFloat(alpha);
1626 out.writeFloat(dimAmount);
1627 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001628 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08001629 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001630 out.writeStrongBinder(token);
1631 out.writeString(packageName);
1632 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
1633 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07001634 out.writeFloat(preferredRefreshRate);
Joe Onorato664644d2011-01-23 17:53:23 -08001635 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08001636 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08001637 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07001638 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001639 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07001640 out.writeInt(surfaceInsets.left);
1641 out.writeInt(surfaceInsets.top);
1642 out.writeInt(surfaceInsets.right);
1643 out.writeInt(surfaceInsets.bottom);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001644 out.writeInt(needsMenuKey);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001645 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001646
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001647 public static final Parcelable.Creator<LayoutParams> CREATOR
1648 = new Parcelable.Creator<LayoutParams>() {
1649 public LayoutParams createFromParcel(Parcel in) {
1650 return new LayoutParams(in);
1651 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001652
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001653 public LayoutParams[] newArray(int size) {
1654 return new LayoutParams[size];
1655 }
1656 };
Wonsik Kim475e3f02014-03-17 11:17:47 +00001657
1658
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001659 public LayoutParams(Parcel in) {
1660 width = in.readInt();
1661 height = in.readInt();
1662 x = in.readInt();
1663 y = in.readInt();
1664 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001665 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001666 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001667 softInputMode = in.readInt();
1668 gravity = in.readInt();
1669 horizontalMargin = in.readFloat();
1670 verticalMargin = in.readFloat();
1671 format = in.readInt();
1672 windowAnimations = in.readInt();
1673 alpha = in.readFloat();
1674 dimAmount = in.readFloat();
1675 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001676 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08001677 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001678 token = in.readStrongBinder();
1679 packageName = in.readString();
1680 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
1681 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07001682 preferredRefreshRate = in.readFloat();
Joe Onorato664644d2011-01-23 17:53:23 -08001683 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08001684 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001685 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07001686 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001687 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07001688 surfaceInsets.left = in.readInt();
1689 surfaceInsets.top = in.readInt();
1690 surfaceInsets.right = in.readInt();
1691 surfaceInsets.bottom = in.readInt();
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001692 needsMenuKey = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001693 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001694
Romain Guy72998072009-06-22 11:09:20 -07001695 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001696 public static final int LAYOUT_CHANGED = 1<<0;
1697 public static final int TYPE_CHANGED = 1<<1;
1698 public static final int FLAGS_CHANGED = 1<<2;
1699 public static final int FORMAT_CHANGED = 1<<3;
1700 public static final int ANIMATION_CHANGED = 1<<4;
1701 public static final int DIM_AMOUNT_CHANGED = 1<<5;
1702 public static final int TITLE_CHANGED = 1<<6;
1703 public static final int ALPHA_CHANGED = 1<<7;
1704 public static final int MEMORY_TYPE_CHANGED = 1<<8;
1705 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
1706 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
1707 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08001708 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001709 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001710 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08001711 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001712 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08001713 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001714 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07001715 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001716 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001717 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001718 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07001719 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001720 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001721 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04001722 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
1723 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07001724 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001725 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07001726 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
1727 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001728 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
1729 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07001730 public static final int EVERYTHING_CHANGED = 0xffffffff;
1731
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001732 // internal buffer to backup/restore parameters under compatibility mode.
1733 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001734
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001735 public final int copyFrom(LayoutParams o) {
1736 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001737
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001738 if (width != o.width) {
1739 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07001740 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001741 }
1742 if (height != o.height) {
1743 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07001744 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001745 }
1746 if (x != o.x) {
1747 x = o.x;
1748 changes |= LAYOUT_CHANGED;
1749 }
1750 if (y != o.y) {
1751 y = o.y;
1752 changes |= LAYOUT_CHANGED;
1753 }
1754 if (horizontalWeight != o.horizontalWeight) {
1755 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001756 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001757 }
1758 if (verticalWeight != o.verticalWeight) {
1759 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001760 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001761 }
1762 if (horizontalMargin != o.horizontalMargin) {
1763 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001764 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001765 }
1766 if (verticalMargin != o.verticalMargin) {
1767 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001768 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001769 }
1770 if (type != o.type) {
1771 type = o.type;
1772 changes |= TYPE_CHANGED;
1773 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001774 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04001775 final int diff = flags ^ o.flags;
1776 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
1777 changes |= TRANSLUCENT_FLAGS_CHANGED;
1778 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001779 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07001780 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001781 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001782 if (privateFlags != o.privateFlags) {
1783 privateFlags = o.privateFlags;
1784 changes |= PRIVATE_FLAGS_CHANGED;
1785 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001786 if (softInputMode != o.softInputMode) {
1787 softInputMode = o.softInputMode;
1788 changes |= SOFT_INPUT_MODE_CHANGED;
1789 }
1790 if (gravity != o.gravity) {
1791 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07001792 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001793 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001794 if (format != o.format) {
1795 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07001796 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001797 }
1798 if (windowAnimations != o.windowAnimations) {
1799 windowAnimations = o.windowAnimations;
1800 changes |= ANIMATION_CHANGED;
1801 }
1802 if (token == null) {
1803 // NOTE: token only copied if the recipient doesn't
1804 // already have one.
1805 token = o.token;
1806 }
1807 if (packageName == null) {
1808 // NOTE: packageName only copied if the recipient doesn't
1809 // already have one.
1810 packageName = o.packageName;
1811 }
1812 if (!mTitle.equals(o.mTitle)) {
1813 mTitle = o.mTitle;
1814 changes |= TITLE_CHANGED;
1815 }
1816 if (alpha != o.alpha) {
1817 alpha = o.alpha;
1818 changes |= ALPHA_CHANGED;
1819 }
1820 if (dimAmount != o.dimAmount) {
1821 dimAmount = o.dimAmount;
1822 changes |= DIM_AMOUNT_CHANGED;
1823 }
1824 if (screenBrightness != o.screenBrightness) {
1825 screenBrightness = o.screenBrightness;
1826 changes |= SCREEN_BRIGHTNESS_CHANGED;
1827 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001828 if (buttonBrightness != o.buttonBrightness) {
1829 buttonBrightness = o.buttonBrightness;
1830 changes |= BUTTON_BRIGHTNESS_CHANGED;
1831 }
Craig Mautner3c174372013-02-21 17:54:37 -08001832 if (rotationAnimation != o.rotationAnimation) {
1833 rotationAnimation = o.rotationAnimation;
1834 changes |= ROTATION_ANIMATION_CHANGED;
1835 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001836
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001837 if (screenOrientation != o.screenOrientation) {
1838 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07001839 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001840 }
Romain Guy529b60a2010-08-03 18:05:47 -07001841
Michael Wright3f145a22014-07-22 19:46:03 -07001842 if (preferredRefreshRate != o.preferredRefreshRate) {
1843 preferredRefreshRate = o.preferredRefreshRate;
1844 changes |= PREFERRED_REFRESH_RATE_CHANGED;
1845 }
1846
Joe Onorato14782f72011-01-25 19:53:17 -08001847 if (systemUiVisibility != o.systemUiVisibility
1848 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08001849 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08001850 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08001851 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
1852 }
1853
1854 if (hasSystemUiListeners != o.hasSystemUiListeners) {
1855 hasSystemUiListeners = o.hasSystemUiListeners;
1856 changes |= SYSTEM_UI_LISTENER_CHANGED;
1857 }
1858
Jeff Brown474dcb52011-06-14 20:22:50 -07001859 if (inputFeatures != o.inputFeatures) {
1860 inputFeatures = o.inputFeatures;
1861 changes |= INPUT_FEATURES_CHANGED;
1862 }
1863
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001864 if (userActivityTimeout != o.userActivityTimeout) {
1865 userActivityTimeout = o.userActivityTimeout;
1866 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
1867 }
1868
Alan Viverette49a22e82014-07-12 20:01:27 -07001869 if (!surfaceInsets.equals(o.surfaceInsets)) {
1870 surfaceInsets.set(o.surfaceInsets);
1871 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001872 }
1873
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001874 if (needsMenuKey != o.needsMenuKey) {
1875 needsMenuKey = o.needsMenuKey;
1876 changes |= NEEDS_MENU_KEY_CHANGED;
1877 }
1878
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001879 return changes;
1880 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001881
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001882 @Override
1883 public String debug(String output) {
1884 output += "Contents of " + this + ":";
1885 Log.d("Debug", output);
1886 output = super.debug("");
1887 Log.d("Debug", output);
1888 Log.d("Debug", "");
1889 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
1890 return "";
1891 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001892
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001893 @Override
1894 public String toString() {
1895 StringBuilder sb = new StringBuilder(256);
1896 sb.append("WM.LayoutParams{");
1897 sb.append("(");
1898 sb.append(x);
1899 sb.append(',');
1900 sb.append(y);
1901 sb.append(")(");
Romain Guy980a9382010-01-08 15:06:28 -08001902 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001903 sb.append('x');
Romain Guy980a9382010-01-08 15:06:28 -08001904 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001905 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001906 if (horizontalMargin != 0) {
1907 sb.append(" hm=");
1908 sb.append(horizontalMargin);
1909 }
1910 if (verticalMargin != 0) {
1911 sb.append(" vm=");
1912 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001913 }
1914 if (gravity != 0) {
1915 sb.append(" gr=#");
1916 sb.append(Integer.toHexString(gravity));
1917 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001918 if (softInputMode != 0) {
1919 sb.append(" sim=#");
1920 sb.append(Integer.toHexString(softInputMode));
1921 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001922 sb.append(" ty=");
1923 sb.append(type);
1924 sb.append(" fl=#");
1925 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001926 if (privateFlags != 0) {
Adam Lesinski95c42972013-10-02 10:13:27 -07001927 if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
1928 sb.append(" compatible=true");
1929 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001930 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
1931 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001932 if (format != PixelFormat.OPAQUE) {
1933 sb.append(" fmt=");
1934 sb.append(format);
1935 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001936 if (windowAnimations != 0) {
1937 sb.append(" wanim=0x");
1938 sb.append(Integer.toHexString(windowAnimations));
1939 }
1940 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
1941 sb.append(" or=");
1942 sb.append(screenOrientation);
1943 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001944 if (alpha != 1.0f) {
1945 sb.append(" alpha=");
1946 sb.append(alpha);
1947 }
1948 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1949 sb.append(" sbrt=");
1950 sb.append(screenBrightness);
1951 }
1952 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1953 sb.append(" bbrt=");
1954 sb.append(buttonBrightness);
1955 }
Craig Mautner3c174372013-02-21 17:54:37 -08001956 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
1957 sb.append(" rotAnim=");
1958 sb.append(rotationAnimation);
1959 }
Michael Wright3f145a22014-07-22 19:46:03 -07001960 if (preferredRefreshRate != 0) {
1961 sb.append(" preferredRefreshRate=");
1962 sb.append(preferredRefreshRate);
1963 }
Joe Onorato664644d2011-01-23 17:53:23 -08001964 if (systemUiVisibility != 0) {
1965 sb.append(" sysui=0x");
1966 sb.append(Integer.toHexString(systemUiVisibility));
1967 }
Joe Onorato14782f72011-01-25 19:53:17 -08001968 if (subtreeSystemUiVisibility != 0) {
1969 sb.append(" vsysui=0x");
1970 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
1971 }
Joe Onorato664644d2011-01-23 17:53:23 -08001972 if (hasSystemUiListeners) {
1973 sb.append(" sysuil=");
1974 sb.append(hasSystemUiListeners);
1975 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001976 if (inputFeatures != 0) {
1977 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
1978 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001979 if (userActivityTimeout >= 0) {
1980 sb.append(" userActivityTimeout=").append(userActivityTimeout);
1981 }
Alan Viverette49a22e82014-07-12 20:01:27 -07001982 if (!surfaceInsets.equals(Insets.NONE)) {
1983 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viveretteccb11e12014-07-08 16:04:02 -07001984 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001985 if (needsMenuKey != NEEDS_MENU_UNSET) {
1986 sb.append(" needsMenuKey=");
1987 sb.append(needsMenuKey);
1988 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001989 sb.append('}');
1990 return sb.toString();
1991 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001992
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001993 /**
1994 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001995 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001996 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001997 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001998 x = (int) (x * scale + 0.5f);
1999 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002000 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002001 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002002 }
2003 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002004 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002005 }
2006 }
2007
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002008 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002009 * Backup the layout parameters used in compatibility mode.
2010 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002011 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002012 void backup() {
2013 int[] backup = mCompatibilityParamsBackup;
2014 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002015 // we backup 4 elements, x, y, width, height
2016 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002017 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002018 backup[0] = x;
2019 backup[1] = y;
2020 backup[2] = width;
2021 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002022 }
2023
2024 /**
2025 * Restore the layout params' coordinates, size and gravity
2026 * @see LayoutParams#backup()
2027 */
2028 void restore() {
2029 int[] backup = mCompatibilityParamsBackup;
2030 if (backup != null) {
2031 x = backup[0];
2032 y = backup[1];
2033 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002034 height = backup[3];
2035 }
2036 }
2037
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002038 private CharSequence mTitle = "";
2039 }
2040}