blob: 6e025161f4cef25352c44215a7321489ecf74128 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.view;
18
Siva Velusamy0d857b92015-04-22 10:23:56 -070019import android.annotation.NonNull;
Bryce Lee53b9fbd2015-02-06 12:06:34 -080020import android.annotation.SystemApi;
Jeff Browna492c3a2012-08-23 19:48:44 -070021import android.app.Presentation;
22import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.pm.ActivityInfo;
24import 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
Clara Bayarri75e09792015-07-29 16:20:40 +010032import java.util.List;
Wale Ogunwale1f240c92016-02-22 18:04:58 -080033import java.util.Objects;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034
35/**
36 * The interface that apps use to talk to the window manager.
37 * <p>
38 * Use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> to get one of these.
Jeff Browna492c3a2012-08-23 19:48:44 -070039 * </p><p>
40 * Each window manager instance is bound to a particular {@link Display}.
41 * To obtain a {@link WindowManager} for a different display, use
42 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
43 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
44 * to get the WindowManager.
45 * </p><p>
46 * The simplest way to show a window on another display is to create a
47 * {@link Presentation}. The presentation will automatically obtain a
48 * {@link WindowManager} and {@link Context} for that display.
49 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050 *
51 * @see android.content.Context#getSystemService
52 * @see android.content.Context#WINDOW_SERVICE
53 */
54public interface WindowManager extends ViewManager {
Jorim Jaggi61f39a72015-10-29 16:54:18 +010055
56 /** @hide */
57 int DOCKED_INVALID = -1;
58 /** @hide */
59 int DOCKED_LEFT = 1;
60 /** @hide */
61 int DOCKED_TOP = 2;
62 /** @hide */
63 int DOCKED_RIGHT = 3;
64 /** @hide */
65 int DOCKED_BOTTOM = 4;
66
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 /**
68 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +010069 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 * is invalid.
71 */
72 public static class BadTokenException extends RuntimeException {
73 public BadTokenException() {
74 }
75
76 public BadTokenException(String name) {
77 super(name);
78 }
79 }
80
81 /**
Craig Mautner6018aee2012-10-23 14:27:49 -070082 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
83 * be found. See {@link android.app.Presentation} for more information on secondary displays.
84 */
85 public static class InvalidDisplayException extends RuntimeException {
86 public InvalidDisplayException() {
87 }
88
89 public InvalidDisplayException(String name) {
90 super(name);
91 }
92 }
93
94 /**
Jeff Browna492c3a2012-08-23 19:48:44 -070095 * Returns the {@link Display} upon which this {@link WindowManager} instance
96 * will create new windows.
97 * <p>
98 * Despite the name of this method, the display that is returned is not
99 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
100 * The returned display could instead be a secondary display that this
101 * window manager instance is managing. Think of it as the display that
102 * this {@link WindowManager} instance uses by default.
103 * </p><p>
104 * To create windows on a different display, you need to obtain a
105 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
106 * class documentation for more information.)
107 * </p>
108 *
109 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 */
111 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -0700112
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800113 /**
114 * Special variation of {@link #removeView} that immediately invokes
115 * the given view hierarchy's {@link View#onDetachedFromWindow()
116 * View.onDetachedFromWindow()} methods before returning. This is not
117 * for normal applications; using it correctly requires great care.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700118 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800119 * @param view The view to be removed.
120 */
121 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700122
Clara Bayarri75e09792015-07-29 16:20:40 +0100123 /**
124 * Used to asynchronously request Keyboard Shortcuts from the focused window.
125 *
126 * @hide
127 */
128 public interface KeyboardShortcutsReceiver {
129 /**
130 * Callback used when the focused window keyboard shortcuts are ready to be displayed.
131 *
132 * @param result The keyboard shortcuts to be displayed.
133 */
134 void onKeyboardShortcutsReceived(List<KeyboardShortcutGroup> result);
135 }
136
137 /**
138 * @hide
139 */
140 public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array";
141
142 /**
143 * Request for keyboard shortcuts to be retrieved asynchronously.
144 *
145 * @param receiver The callback to be triggered when the result is ready.
146 *
147 * @hide
148 */
149 public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver);
150
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -0800151 public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 /**
153 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700154 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
155 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 */
Romain Guy529b60a2010-08-03 18:05:47 -0700157 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800158 public int x;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700159
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800160 /**
161 * Y position for this window. With the default gravity it is ignored.
162 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
163 * an offset from the given edge.
164 */
Romain Guy529b60a2010-08-03 18:05:47 -0700165 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800166 public int y;
167
168 /**
169 * Indicates how much of the extra space will be allocated horizontally
170 * to the view associated with these LayoutParams. Specify 0 if the view
171 * should not be stretched. Otherwise the extra pixels will be pro-rated
172 * among all views whose weight is greater than 0.
173 */
Romain Guy529b60a2010-08-03 18:05:47 -0700174 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800175 public float horizontalWeight;
176
177 /**
178 * Indicates how much of the extra space will be allocated vertically
179 * to the view associated with these LayoutParams. Specify 0 if the view
180 * should not be stretched. Otherwise the extra pixels will be pro-rated
181 * among all views whose weight is greater than 0.
182 */
Romain Guy529b60a2010-08-03 18:05:47 -0700183 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800184 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700185
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800186 /**
187 * The general type of window. There are three main classes of
188 * window types:
189 * <ul>
190 * <li> <strong>Application windows</strong> (ranging from
191 * {@link #FIRST_APPLICATION_WINDOW} to
192 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
193 * windows. For these types of windows, the {@link #token} must be
194 * set to the token of the activity they are a part of (this will
195 * normally be done for you if {@link #token} is null).
196 * <li> <strong>Sub-windows</strong> (ranging from
197 * {@link #FIRST_SUB_WINDOW} to
198 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
199 * window. For these types of windows, the {@link #token} must be
200 * the token of the window it is attached to.
201 * <li> <strong>System windows</strong> (ranging from
202 * {@link #FIRST_SYSTEM_WINDOW} to
203 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
204 * use by the system for specific purposes. They should not normally
205 * be used by applications, and a special permission is required
206 * to use them.
207 * </ul>
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700208 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800209 * @see #TYPE_BASE_APPLICATION
210 * @see #TYPE_APPLICATION
211 * @see #TYPE_APPLICATION_STARTING
212 * @see #TYPE_APPLICATION_PANEL
213 * @see #TYPE_APPLICATION_MEDIA
214 * @see #TYPE_APPLICATION_SUB_PANEL
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700215 * @see #TYPE_APPLICATION_ABOVE_SUB_PANEL
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800216 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
217 * @see #TYPE_STATUS_BAR
218 * @see #TYPE_SEARCH_BAR
219 * @see #TYPE_PHONE
220 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800221 * @see #TYPE_TOAST
222 * @see #TYPE_SYSTEM_OVERLAY
223 * @see #TYPE_PRIORITY_PHONE
224 * @see #TYPE_STATUS_BAR_PANEL
225 * @see #TYPE_SYSTEM_DIALOG
226 * @see #TYPE_KEYGUARD_DIALOG
227 * @see #TYPE_SYSTEM_ERROR
228 * @see #TYPE_INPUT_METHOD
229 * @see #TYPE_INPUT_METHOD_DIALOG
230 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700231 @ViewDebug.ExportedProperty(mapping = {
232 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
233 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
234 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
235 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
236 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
237 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700238 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL, to = "TYPE_APPLICATION_ABOVE_SUB_PANEL"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700239 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700240 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700241 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
242 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
243 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
244 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700245 @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
246 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
247 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700248 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"),
249 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
250 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
251 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
Jeff Brown3b2b3542010-10-15 00:54:27 -0700252 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700253 @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
254 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700255 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700256 @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
257 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
258 @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
259 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
260 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700261 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
Selim Cinekf83e8242015-05-19 18:08:14 -0700262 @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER, to = "TYPE_INPUT_CONSUMER"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700263 @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
Jeff Brownbd6e1502012-08-28 03:27:37 -0700264 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"),
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700265 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"),
keunyounga446bf02013-06-21 19:07:57 -0700266 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY"),
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700267 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION"),
268 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, to = "TYPE_VOICE_INTERACTION"),
Jorim Jaggi225d3b52015-04-01 11:18:57 -0700269 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, to = "TYPE_VOICE_INTERACTION_STARTING"),
Filip Gruszczynski466f3212015-09-21 17:57:57 -0700270 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER, to = "TYPE_DOCK_DIVIDER"),
Jason Monk8f7f3182015-11-18 16:35:14 -0500271 @ViewDebug.IntToString(from = TYPE_QS_DIALOG, to = "TYPE_QS_DIALOG"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700272 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800273 public int type;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275 /**
276 * Start of window types that represent normal application windows.
277 */
278 public static final int FIRST_APPLICATION_WINDOW = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700279
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800280 /**
281 * Window type: an application window that serves as the "base" window
282 * of the overall application; all other application windows will
283 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700284 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800285 */
286 public static final int TYPE_BASE_APPLICATION = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700287
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800288 /**
289 * Window type: a normal application window. The {@link #token} must be
290 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700291 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292 */
293 public static final int TYPE_APPLICATION = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700294
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295 /**
296 * Window type: special application window that is displayed while the
297 * application is starting. Not for use by applications themselves;
298 * this is used by the system to display something until the
299 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700300 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800301 */
302 public static final int TYPE_APPLICATION_STARTING = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700303
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800304 /**
305 * End of types of application windows.
306 */
307 public static final int LAST_APPLICATION_WINDOW = 99;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700308
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800309 /**
310 * Start of types of sub-windows. The {@link #token} of these windows
311 * must be set to the window they are attached to. These types of
312 * windows are kept next to their attached window in Z-order, and their
313 * coordinate space is relative to their attached window.
314 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700315 public static final int FIRST_SUB_WINDOW = 1000;
316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 /**
318 * Window type: a panel on top of an application window. These windows
319 * appear on top of their attached window.
320 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700321 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
322
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800323 /**
John Spurlock33291d82013-03-13 14:45:14 -0400324 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800325 * are displayed behind their attached window.
326 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700327 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1;
328
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800329 /**
330 * Window type: a sub-panel on top of an application window. These
331 * windows are displayed on top their attached window and any
332 * {@link #TYPE_APPLICATION_PANEL} panels.
333 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700334 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335
336 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
337 * of the window happens as that of a top-level window, <em>not</em>
338 * as a child of its container.
339 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700340 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3;
341
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800342 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700343 * Window type: window for showing overlays on top of media windows.
344 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
345 * application window. They should be translucent to be useful. This
346 * is a big ugly hack so:
347 * @hide
348 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700349 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4;
350
351 /**
352 * Window type: a above sub-panel on top of an application window and it's
353 * sub-panel windows. These windows are displayed on top of their attached window
354 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels.
Wale Ogunwale3540f932015-06-02 11:07:07 -0700355 * @hide
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700356 */
357 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5;
358
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700359 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800360 * End of types of sub-windows.
361 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700362 public static final int LAST_SUB_WINDOW = 1999;
363
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800364 /**
365 * Start of system-specific window types. These are not normally
366 * created by applications.
367 */
368 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700369
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 /**
371 * Window type: the status bar. There can be only one status bar
372 * window; it is placed at the top of the screen, and all other
373 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700374 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800375 */
376 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700377
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800378 /**
379 * Window type: the search bar. There can be only one search bar
380 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700381 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800382 */
383 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 /**
386 * Window type: phone. These are non-application windows providing
387 * user interaction with the phone (in particular incoming calls).
388 * These windows are normally placed above all applications, but behind
389 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700390 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800391 */
392 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700393
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800394 /**
395 * Window type: system window, such as low power alert. These windows
396 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700397 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800398 */
399 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100400
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800401 /**
402 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700403 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200404 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800405 */
406 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100407
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800408 /**
409 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700410 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 */
412 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700413
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800414 /**
415 * Window type: system overlay windows, which need to be displayed
416 * on top of everything else. These windows must not take input
417 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700418 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 */
420 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700421
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800422 /**
423 * Window type: priority phone UI, which needs to be displayed even if
424 * the keyguard is active. These windows must not take input
425 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700426 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 */
428 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700429
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800430 /**
431 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700432 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800433 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800434 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700435
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800436 /**
437 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700438 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800439 */
440 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700441
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 /**
443 * Window type: internal system error windows, appear on top of
444 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700445 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800446 */
447 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700448
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800449 /**
450 * Window type: internal input methods windows, which appear above
451 * the normal UI. Application windows may be resized or panned to keep
452 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700453 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800454 */
455 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
456
457 /**
458 * Window type: internal input methods dialog windows, which appear above
459 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700460 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800461 */
462 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
463
464 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700465 * Window type: wallpaper window, placed behind any window that wants
466 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700467 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700468 */
469 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
470
471 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800472 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700473 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800474 */
475 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700476
477 /**
478 * Window type: secure system overlay windows, which need to be displayed
479 * on top of everything else. These windows must not take input
480 * focus, or they will interfere with the keyguard.
481 *
482 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
483 * system itself is allowed to create these overlays. Applications cannot
484 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700485 *
486 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700487 * @hide
488 */
489 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
490
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800491 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700492 * Window type: the drag-and-drop pseudowindow. There is only one
493 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700494 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700495 * @hide
496 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700497 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700498
499 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800500 * Window type: panel that slides out from under the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700501 * In multiuser systems shows on all users' windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800502 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800503 */
504 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
505
Jeff Brown83c09682010-12-23 17:50:18 -0800506 /**
507 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700508 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800509 * @hide
510 */
511 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800512
513 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400514 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700515 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400516 * @hide
517 */
518 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
519
520 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700521 * Window type: The volume level overlay/dialog shown when the user
522 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700523 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700524 * @hide
525 */
526 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
527
528 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700529 * Window type: The boot progress dialog, goes on top of everything
530 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700531 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700532 * @hide
533 */
534 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
535
536 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700537 * Window type to consume input events when the systemUI bars are hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700538 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700539 * @hide
540 */
Selim Cinekf83e8242015-05-19 18:08:14 -0700541 public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22;
Dianne Hackborndf89e652011-10-06 22:35:11 -0700542
543 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500544 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700545 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500546 * @hide
547 */
548 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
549
550 /**
Jim Millere898ac52012-04-06 17:10:57 -0700551 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700552 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700553 * @hide
554 */
555 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
556
557 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700558 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700559 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700560 * @hide
561 */
562 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
563
564 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700565 * Window type: Magnification overlay window. Used to highlight the magnified
566 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -0700567 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700568 * @hide
569 */
570 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
571
572 /**
Jim Miller5ecd8112013-01-09 18:50:26 -0800573 * Window type: keyguard scrim window. Shows if keyguard needs to be restarted.
574 * In multiuser systems shows on all users' windows.
575 * @hide
576 */
577 public static final int TYPE_KEYGUARD_SCRIM = FIRST_SYSTEM_WINDOW+29;
578
Craig Mautner88400d32012-09-30 12:35:45 -0700579 /**
keunyounga446bf02013-06-21 19:07:57 -0700580 * Window type: Window for Presentation on top of private
581 * virtual display.
582 */
583 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
584
585 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700586 * Window type: Windows in the voice interaction layer.
587 * @hide
588 */
589 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
590
591 /**
Phil Weaver40ded282016-01-25 15:49:02 -0800592 * Window type: Windows that are overlaid <em>only</em> by a connected {@link
Svetoslav3a5c7212014-10-14 09:54:26 -0700593 * android.accessibilityservice.AccessibilityService} for interception of
594 * user interactions without changing the windows an accessibility service
595 * can introspect. In particular, an accessibility service can introspect
596 * only windows that a sighted user can interact with which is they can touch
597 * these windows or can type into these windows. For example, if there
598 * is a full screen accessibility overlay that is touchable, the windows
Phil Weaver40ded282016-01-25 15:49:02 -0800599 * below it will be introspectable by an accessibility service even though
Svetoslav3a5c7212014-10-14 09:54:26 -0700600 * they are covered by a touchable window.
601 */
602 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
603
604 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -0700605 * Window type: Starting window for voice interaction layer.
606 * @hide
607 */
608 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
609
610 /**
Filip Gruszczynski466f3212015-09-21 17:57:57 -0700611 * Window for displaying a handle used for resizing docked stacks. This window is owned
612 * by the system process.
613 * @hide
614 */
615 public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34;
616
617 /**
Jason Monk8f7f3182015-11-18 16:35:14 -0500618 * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used
619 * by Quick Settings Tiles.
620 * @hide
621 */
622 public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35;
623
624 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800625 * End of types of system windows.
626 */
627 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800628
Mathias Agopiand2112302010-12-07 19:38:17 -0800629 /** @deprecated this is ignored, this value is set automatically when needed. */
630 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800631 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800632 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700633 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800634 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800635 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700636 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800637 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800638 /** @deprecated this is ignored, this value is set automatically when needed. */
639 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700641
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700643 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800644 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700645 @Deprecated
646 public int memoryType;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700647
Mike Lockwoodef731622010-01-27 17:51:34 -0500648 /** Window flag: as long as this window is visible to the user, allow
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700649 * the lock screen to activate while the screen is on.
650 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800651 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500652 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
653
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800654 /** Window flag: everything behind this window will be dimmed.
655 * Use {@link #dimAmount} to control the amount of dim. */
656 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700657
658 /** Window flag: blur everything behind this window.
659 * @deprecated Blurring is no longer supported. */
660 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800661 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700662
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800663 /** Window flag: this window won't ever get key input focus, so the
664 * user can not send key or other button events to it. Those will
665 * instead go to whatever focusable window is behind it. This flag
666 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
667 * is explicitly set.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700668 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800669 * <p>Setting this flag also implies that the window will not need to
670 * interact with
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700671 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800672 * independently of any active input method (typically this means it
673 * gets Z-ordered on top of the input method, so it can use the full
674 * screen for its content and cover the input method if needed. You
675 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
676 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700677
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 /** Window flag: this window can never receive touch events. */
679 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700680
John Spurlock33291d82013-03-13 14:45:14 -0400681 /** Window flag: even when this window is focusable (its
682 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800683 * outside of the window to be sent to the windows behind it. Otherwise
684 * it will consume all pointer events itself, regardless of whether they
685 * are inside of the window. */
686 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700687
John Spurlock33291d82013-03-13 14:45:14 -0400688 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800689 * screen is pressed, you will receive this first touch event. Usually
690 * the first touch event is consumed by the system since the user can
691 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -0700692 *
693 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 */
Jeff Brown037c33e2014-04-09 00:31:55 -0700695 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800696 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700697
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 /** Window flag: as long as this window is visible to the user, keep
699 * the device's screen turned on and bright. */
700 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700701
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800702 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -0400703 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 * window must correctly position its contents to take the screen
705 * decoration into account. This flag is normally set for you
706 * by Window as described in {@link Window#setFlags}. */
707 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700708
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800709 /** Window flag: allow window to extend outside of the screen. */
710 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700711
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800712 /**
John Spurlock33291d82013-03-13 14:45:14 -0400713 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800714 * this window is displayed. This allows the window to use the entire
715 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -0700716 * an app window with this flag set is on the top layer. A fullscreen window
717 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
718 * {@link #softInputMode} field; the window will stay fullscreen
719 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800720 *
721 * <p>This flag can be controlled in your theme through the
722 * {@link android.R.attr#windowFullscreen} attribute; this attribute
723 * is automatically set for you in the standard fullscreen themes
724 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
725 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
726 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
727 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
728 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
729 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
730 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
731 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800732 public static final int FLAG_FULLSCREEN = 0x00000400;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700733
John Spurlock33291d82013-03-13 14:45:14 -0400734 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
735 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800736 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700737
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800738 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700739 * the screen.
740 * @deprecated This flag is no longer used. */
741 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800742 public static final int FLAG_DITHER = 0x00001000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700743
John Spurlock33291d82013-03-13 14:45:14 -0400744 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -0700745 * it from appearing in screenshots or from being viewed on non-secure
746 * displays.
747 *
748 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
749 * secure surfaces and secure displays.
750 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800751 public static final int FLAG_SECURE = 0x00002000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700752
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800753 /** Window flag: a special mode where the layout parameters are used
754 * to perform scaling of the surface when it is composited to the
755 * screen. */
756 public static final int FLAG_SCALED = 0x00004000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700757
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800758 /** Window flag: intended for windows that will often be used when the user is
759 * holding the screen against their face, it will aggressively filter the event
760 * stream to prevent unintended presses in this situation that may not be
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700761 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800762 * application will receive a CANCEL motion event to indicate this so applications
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700763 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 * until the finger is released. */
765 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700766
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800767 /** Window flag: a special option only for use in combination with
768 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
769 * screen your window may appear on top of or behind screen decorations
770 * such as the status bar. By also including this flag, the window
771 * manager will report the inset rectangle needed to ensure your
772 * content is not covered by screen decorations. This flag is normally
773 * set for you by Window as described in {@link Window#setFlags}.*/
774 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700775
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800776 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
777 * respect to how this window interacts with the current method. That
778 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
779 * window will behave as if it needs to interact with the input method
780 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
781 * not set and this flag is set, then the window will behave as if it
782 * doesn't need to interact with the input method and can be placed
783 * to use more space and cover the input method.
784 */
785 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700786
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
788 * can set this flag to receive a single special MotionEvent with
789 * the action
790 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
791 * touches that occur outside of your window. Note that you will not
792 * receive the full down/move/up gesture, only the location of the
793 * first down as an ACTION_OUTSIDE.
794 */
795 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700796
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700797 /** Window flag: special flag to let windows be shown when the screen
798 * is locked. This will let application windows take precedence over
799 * key guard or any other lock screens. Can be used with
800 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700801 * directly before showing the key guard window. Can be used with
802 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
803 * non-secure keyguards. This flag only applies to the top-most
804 * full-screen window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700805 */
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700806 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
807
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700808 /** Window flag: ask that the system wallpaper be shown behind
809 * your window. The window surface must be translucent to be able
810 * to actually see the wallpaper behind it; this flag just ensures
811 * that the wallpaper surface will be there if this window actually
812 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800813 *
814 * <p>This flag can be controlled in your theme through the
815 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
816 * is automatically set for you in the standard wallpaper themes
817 * such as {@link android.R.style#Theme_Wallpaper},
818 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
819 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
820 * {@link android.R.style#Theme_Holo_Wallpaper},
821 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
822 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
823 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700824 */
825 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700826
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700827 /** Window flag: when set as a window is being added or made
828 * visible, once the window has been shown then the system will
829 * poke the power manager's user activity (as if the user had woken
830 * up the device) to turn the screen on. */
831 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700832
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700833 /** Window flag: when set the window will cause the keyguard to
834 * be dismissed, only if it is not a secure lock keyguard. Because such
835 * a keyguard is not needed for security, it will never re-appear if
836 * the user navigates to another window (in contrast to
837 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
838 * hide both secure and non-secure keyguards but ensure they reappear
839 * when the user moves to another UI that doesn't hide them).
840 * If the keyguard is currently active and is secure (requires an
841 * unlock pattern) than the user will still need to confirm it before
842 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
Daniel Sandlerae069f72010-06-17 21:56:26 -0400843 * also been set.
844 */
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700845 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700846
Jeff Brown01ce2e92010-09-26 22:20:12 -0700847 /** Window flag: when set the window will accept for touch events
848 * outside of its bounds to be sent to other windows that also
849 * support split touch. When this flag is not set, the first pointer
850 * that goes down determines the window to which all subsequent touches
851 * go until all pointers go up. When this flag is set, each pointer
852 * (not necessarily the first) that goes down determines the window
853 * to which all subsequent touches of that pointer will go until that
854 * pointer goes up thereby enabling touches with multiple pointers
855 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800856 */
Jeff Brown01ce2e92010-09-26 22:20:12 -0700857 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700858
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800859 /**
Romain Guy72f0a272011-01-09 16:01:46 -0800860 * <p>Indicates whether this window should be hardware accelerated.
861 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800862 *
Romain Guy72f0a272011-01-09 16:01:46 -0800863 * <p>This flag can be controlled programmatically <em>only</em> to enable
864 * hardware acceleration. To enable hardware acceleration for a given
865 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800866 *
Romain Guy72f0a272011-01-09 16:01:46 -0800867 * <pre>
868 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
869 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
870 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
871 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800872 *
Romain Guy72f0a272011-01-09 16:01:46 -0800873 * <p>It is important to remember that this flag <strong>must</strong>
874 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800875 *
Romain Guy72f0a272011-01-09 16:01:46 -0800876 * <p>This flag cannot be used to disable hardware acceleration after it
877 * was enabled in your manifest using
878 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
879 * and programmatically disable hardware acceleration (for automated testing
880 * for instance), make sure it is turned off in your manifest and enable it
881 * on your activity or dialog when you need it instead, using the method
882 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800883 *
Romain Guy72f0a272011-01-09 16:01:46 -0800884 * <p>This flag is automatically set by the system if the
885 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
886 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800887 */
888 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -0400889
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800890 /**
891 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -0800892 * overscan area, if there is one. The window should still correctly
893 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800894 *
895 * <p>This flag can be controlled in your theme through the
896 * {@link android.R.attr#windowOverscan} attribute; this attribute
897 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -0700898 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800899 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
900 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
901 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
902 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
903 *
904 * <p>When this flag is enabled for a window, its normal content may be obscured
905 * to some degree by the overscan region of the display. To ensure key parts of
906 * that content are visible to the user, you can use
907 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
908 * to set the point in the view hierarchy where the appropriate offsets should
909 * be applied. (This can be done either by directly calling this function, using
910 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
911 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
912 * View.fitSystemWindows(Rect)} method).</p>
913 *
914 * <p>This mechanism for positioning content elements is identical to its equivalent
915 * use with layout and {@link View#setSystemUiVisibility(int)
916 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
917 * position its UI elements with this overscan flag is set:</p>
918 *
919 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -0800920 */
921 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
922
John Spurlockbd957402013-10-03 11:38:39 -0400923 /**
924 * Window flag: request a translucent status bar with minimal system-provided
925 * background protection.
926 *
927 * <p>This flag can be controlled in your theme through the
928 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
929 * is automatically set for you in the standard translucent decor themes
930 * such as
931 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
932 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
933 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
934 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
935 *
936 * <p>When this flag is enabled for a window, it automatically sets
937 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
938 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
939 */
940 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
941
942 /**
943 * Window flag: request a translucent navigation bar with minimal system-provided
944 * background protection.
945 *
946 * <p>This flag can be controlled in your theme through the
947 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
948 * is automatically set for you in the standard translucent decor themes
949 * such as
950 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
951 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
952 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
953 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
954 *
955 * <p>When this flag is enabled for a window, it automatically sets
956 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
957 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
958 */
959 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
960
Adam Lesinski6a591f52013-10-01 18:11:17 -0700961 /**
962 * Flag for a window in local focus mode.
963 * Window in local focus mode can control focus independent of window manager using
964 * {@link Window#setLocalFocus(boolean, boolean)}.
965 * Usually window in this mode will not get touch/key events from window manager, but will
966 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
967 */
968 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
969
Jeff Brown98db5fa2011-06-08 15:37:10 -0700970 /** Window flag: Enable touches to slide out of a window into neighboring
971 * windows in mid-gesture instead of being captured for the duration of
972 * the gesture.
973 *
974 * This flag changes the behavior of touch focus for this window only.
975 * Touches can slide out of the window but they cannot necessarily slide
976 * back in (unless the other window with touch focus permits it).
977 *
978 * {@hide}
979 */
Adam Lesinski6a591f52013-10-01 18:11:17 -0700980 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -0700981
Daniel Sandlere02d8082010-10-08 15:13:22 -0400982 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -0700983 * Window flag: When requesting layout with an attached window, the attached window may
984 * overlap with the screen decorations of the parent window such as the navigation bar. By
985 * including this flag, the window manager will layout the attached window within the decor
986 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -0400987 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -0700988 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -0400989
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800990 /**
Adrian Roos217ccd22014-05-09 14:29:04 +0200991 * Flag indicating that this Window is responsible for drawing the background for the
992 * system bars. If set, the system bars are drawn with a transparent background and the
993 * corresponding areas in this window are filled with the colors specified in
994 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
995 */
996 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
997
998 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700999 * Various behavioral options/flags. Default is none.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001000 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001001 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
1002 * @see #FLAG_DIM_BEHIND
1003 * @see #FLAG_NOT_FOCUSABLE
1004 * @see #FLAG_NOT_TOUCHABLE
1005 * @see #FLAG_NOT_TOUCH_MODAL
1006 * @see #FLAG_TOUCHABLE_WHEN_WAKING
1007 * @see #FLAG_KEEP_SCREEN_ON
1008 * @see #FLAG_LAYOUT_IN_SCREEN
1009 * @see #FLAG_LAYOUT_NO_LIMITS
1010 * @see #FLAG_FULLSCREEN
1011 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001012 * @see #FLAG_SECURE
1013 * @see #FLAG_SCALED
1014 * @see #FLAG_IGNORE_CHEEK_PRESSES
1015 * @see #FLAG_LAYOUT_INSET_DECOR
1016 * @see #FLAG_ALT_FOCUSABLE_IM
1017 * @see #FLAG_WATCH_OUTSIDE_TOUCH
1018 * @see #FLAG_SHOW_WHEN_LOCKED
1019 * @see #FLAG_SHOW_WALLPAPER
1020 * @see #FLAG_TURN_SCREEN_ON
1021 * @see #FLAG_DISMISS_KEYGUARD
1022 * @see #FLAG_SPLIT_TOUCH
1023 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -07001024 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +02001025 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001026 */
1027 @ViewDebug.ExportedProperty(flagMapping = {
1028 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
1029 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
1030 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
1031 name = "FLAG_DIM_BEHIND"),
1032 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
1033 name = "FLAG_BLUR_BEHIND"),
1034 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
1035 name = "FLAG_NOT_FOCUSABLE"),
1036 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
1037 name = "FLAG_NOT_TOUCHABLE"),
1038 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
1039 name = "FLAG_NOT_TOUCH_MODAL"),
1040 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
1041 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
1042 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
1043 name = "FLAG_KEEP_SCREEN_ON"),
1044 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
1045 name = "FLAG_LAYOUT_IN_SCREEN"),
1046 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
1047 name = "FLAG_LAYOUT_NO_LIMITS"),
1048 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
1049 name = "FLAG_FULLSCREEN"),
1050 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
1051 name = "FLAG_FORCE_NOT_FULLSCREEN"),
1052 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
1053 name = "FLAG_DITHER"),
1054 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
1055 name = "FLAG_SECURE"),
1056 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
1057 name = "FLAG_SCALED"),
1058 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
1059 name = "FLAG_IGNORE_CHEEK_PRESSES"),
1060 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
1061 name = "FLAG_LAYOUT_INSET_DECOR"),
1062 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
1063 name = "FLAG_ALT_FOCUSABLE_IM"),
1064 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
1065 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
1066 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
1067 name = "FLAG_SHOW_WHEN_LOCKED"),
1068 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
1069 name = "FLAG_SHOW_WALLPAPER"),
1070 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
1071 name = "FLAG_TURN_SCREEN_ON"),
1072 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
1073 name = "FLAG_DISMISS_KEYGUARD"),
1074 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
1075 name = "FLAG_SPLIT_TOUCH"),
1076 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
keunyoung30f420f2013-08-02 14:23:10 -07001077 name = "FLAG_HARDWARE_ACCELERATED"),
1078 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
John Spurlockbd957402013-10-03 11:38:39 -04001079 name = "FLAG_LOCAL_FOCUS_MODE"),
1080 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
1081 name = "FLAG_TRANSLUCENT_STATUS"),
1082 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Adrian Roos217ccd22014-05-09 14:29:04 +02001083 name = "FLAG_TRANSLUCENT_NAVIGATION"),
1084 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
1085 name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001086 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001087 public int flags;
1088
1089 /**
John Reck61375a82014-09-18 19:27:48 +00001090 * If the window has requested hardware acceleration, but this is not
1091 * allowed in the process it is in, then still render it as if it is
1092 * hardware accelerated. This is used for the starting preview windows
1093 * in the system process, which don't need to have the overhead of
1094 * hardware acceleration (they are just a static rendering), but should
1095 * be rendered as such to match the actual window of the app even if it
1096 * is hardware accelerated.
1097 * Even if the window isn't hardware accelerated, still do its rendering
1098 * as if it was.
1099 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1100 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001101 * is generally disabled. This flag must be specified in addition to
John Reck61375a82014-09-18 19:27:48 +00001102 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1103 * windows.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001104 *
John Reck61375a82014-09-18 19:27:48 +00001105 * @hide
1106 */
1107 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1108
1109 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001110 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001111 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001112 * If certain parts of the UI that really do want to use hardware
1113 * acceleration, this flag can be set to force it. This is basically
1114 * for the lock screen. Anyone else using it, you are probably wrong.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001115 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001116 * @hide
1117 */
1118 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1119
1120 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001121 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001122 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001123 * them (they do not affect the wallpaper scrolling operation) by calling
1124 * {@link
1125 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1126 *
1127 * @hide
1128 */
1129 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1130
Craig Mautner88400d32012-09-30 12:35:45 -07001131 /** In a multiuser system if this flag is set and the owner is a system process then this
1132 * window will appear on all user screens. This overrides the default behavior of window
1133 * types that normally only appear on the owning user's screen. Refer to each window type
1134 * to determine its default behavior.
1135 *
1136 * {@hide} */
1137 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1138
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001139 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001140 * Never animate position changes of the window.
1141 *
1142 * {@hide} */
1143 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1144
Adam Lesinski6a591f52013-10-01 18:11:17 -07001145 /** Window flag: special flag to limit the size of the window to be
1146 * original size ([320x480] x density). Used to create window for applications
1147 * running under compatibility mode.
1148 *
1149 * {@hide} */
1150 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1151
1152 /** Window flag: a special option intended for system dialogs. When
1153 * this flag is set, the window will demand focus unconditionally when
1154 * it is created.
1155 * {@hide} */
1156 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1157
John Spurlock3f7cd512013-10-07 12:25:09 -04001158 /** Window flag: maintain the previous translucent decor state when this window
John Spurlockbd957402013-10-03 11:38:39 -04001159 * becomes top-most.
1160 * {@hide} */
1161 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
1162
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001163 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001164 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1165 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1166 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1167 * {@hide}
1168 */
1169 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1170
1171 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001172 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1173 *
1174 * {@hide}
1175 */
1176 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1177
1178 /**
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001179 * Flag to force the status bar window to be visible all the time. If the bar is hidden when
1180 * this flag is set it will be shown again and the bar will have a transparent background.
1181 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1182 *
1183 * {@hide}
1184 */
1185 public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000;
1186
1187 /**
Robert Carr64aadd02015-11-06 13:54:20 -08001188 * Flag indicating that the x, y, width, and height members should be
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001189 * ignored (and thus their previous value preserved). For example
Robert Carr64aadd02015-11-06 13:54:20 -08001190 * because they are being managed externally through repositionChild.
1191 *
1192 * {@hide}
1193 */
1194 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000;
1195
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001196 /**
1197 * Flag that will make window ignore app visibility and instead depend purely on the decor
1198 * view visibility for determining window visibility. This is used by recents to keep
1199 * drawing after it launches an app.
1200 * @hide
1201 */
1202 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000;
1203
Robert Carra1eb4392015-12-10 12:43:51 -08001204 /**
1205 * Flag to indicate that this window is not expected to be replaced across
1206 * configuration change triggered activity relaunches. In general the WindowManager
1207 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces
1208 * until the replacement is ready to show in order to prevent visual glitch. However
1209 * some windows, such as PopupWindows expect to be cleared across configuration change,
1210 * and thus should hint to the WindowManager that it should not wait for a replacement.
1211 * @hide
1212 */
1213 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000;
Robert Carr64aadd02015-11-06 13:54:20 -08001214
1215 /**
Wale Ogunwale8216eb22015-12-18 10:42:42 -08001216 * Flag to indicate that this child window should always be laid-out in the parent
1217 * frame regardless of the current windowing mode configuration.
1218 * @hide
1219 */
1220 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000;
1221
1222 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001223 * Control flags that are private to the platform.
1224 * @hide
1225 */
1226 public int privateFlags;
1227
1228 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001229 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1230 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1231 * key. For this case, we should look at windows behind it to determine the appropriate
1232 * value.
1233 *
1234 * @hide
1235 */
1236 public static final int NEEDS_MENU_UNSET = 0;
1237
1238 /**
1239 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1240 * menu key.
1241 *
1242 * @hide
1243 */
1244 public static final int NEEDS_MENU_SET_TRUE = 1;
1245
1246 /**
1247 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1248 * needs a menu key.
1249 *
1250 * @hide
1251 */
1252 public static final int NEEDS_MENU_SET_FALSE = 2;
1253
1254 /**
1255 * State variable for a window belonging to an activity that responds to
1256 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1257 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1258 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1259 *
1260 * (Note that Action Bars, when available, are the preferred way to offer additional
1261 * functions otherwise accessed via an options menu.)
1262 *
1263 * {@hide}
1264 */
1265 public int needsMenuKey = NEEDS_MENU_UNSET;
1266
1267 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001268 * Given a particular set of window manager flags, determine whether
1269 * such a window may be a target for an input method when it has
1270 * focus. In particular, this checks the
1271 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1272 * flags and returns true if the combination of the two corresponds
1273 * to a window that needs to be behind the input method so that the
1274 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001275 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001276 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001277 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 * @return Returns true if such a window should be behind/interact
1279 * with an input method, false if not.
1280 */
1281 public static boolean mayUseInputMethod(int flags) {
1282 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
1283 case 0:
1284 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
1285 return true;
1286 }
1287 return false;
1288 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001289
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001290 /**
1291 * Mask for {@link #softInputMode} of the bits that determine the
1292 * desired visibility state of the soft input area for this window.
1293 */
1294 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001295
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001296 /**
1297 * Visibility state for {@link #softInputMode}: no state has been specified.
1298 */
1299 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001300
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001301 /**
1302 * Visibility state for {@link #softInputMode}: please don't change the state of
1303 * the soft input area.
1304 */
1305 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001306
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001307 /**
1308 * Visibility state for {@link #softInputMode}: please hide any soft input
1309 * area when normally appropriate (when the user is navigating
1310 * forward to your window).
1311 */
1312 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001313
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001314 /**
1315 * Visibility state for {@link #softInputMode}: please always hide any
1316 * soft input area when this window receives focus.
1317 */
1318 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001319
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001320 /**
1321 * Visibility state for {@link #softInputMode}: please show the soft
1322 * input area when normally appropriate (when the user is navigating
1323 * forward to your window).
1324 */
1325 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001326
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001327 /**
1328 * Visibility state for {@link #softInputMode}: please always make the
1329 * soft input area visible when this window receives input focus.
1330 */
1331 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001332
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001333 /**
1334 * Mask for {@link #softInputMode} of the bits that determine the
1335 * way that the window should be adjusted to accommodate the soft
1336 * input window.
1337 */
1338 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001340 /** Adjustment option for {@link #softInputMode}: nothing specified.
1341 * The system will try to pick one or
1342 * the other depending on the contents of the window.
1343 */
1344 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001345
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001346 /** Adjustment option for {@link #softInputMode}: set to allow the
1347 * window to be resized when an input
1348 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07001349 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001350 * {@link #SOFT_INPUT_ADJUST_PAN}; if
1351 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07001352 * the other depending on the contents of the window. If the window's
1353 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
1354 * value for {@link #softInputMode} will be ignored; the window will
1355 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001356 */
1357 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001358
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001359 /** Adjustment option for {@link #softInputMode}: set to have a window
1360 * pan when an input method is
1361 * shown, so it doesn't need to deal with resizing but just panned
1362 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07001363 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001364 * neither of these are set, then the system will try to pick one or
1365 * the other depending on the contents of the window.
1366 */
1367 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001368
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001369 /** Adjustment option for {@link #softInputMode}: set to have a window
1370 * not adjust for a shown input method. The window will not be resized,
1371 * and it will not be panned to make its focus visible.
1372 */
1373 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
1374
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001375 /**
1376 * Bit for {@link #softInputMode}: set when the user has navigated
1377 * forward to the window. This is normally set automatically for
1378 * you by the system, though you may want to set it in certain cases
1379 * when you are displaying a window yourself. This flag will always
1380 * be cleared automatically after the window is displayed.
1381 */
1382 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001383
1384 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08001385 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001386 * of:
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001387 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001388 * <ul>
1389 * <li> One of the visibility states
1390 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
1391 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or
1392 * {@link #SOFT_INPUT_STATE_VISIBLE}.
1393 * <li> One of the adjustment options
1394 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},
1395 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or
1396 * {@link #SOFT_INPUT_ADJUST_PAN}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001397 * </ul>
1398 *
1399 *
1400 * <p>This flag can be controlled in your theme through the
1401 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001402 */
1403 public int softInputMode;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001404
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001405 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001406 * Placement of window within the screen as per {@link Gravity}. Both
1407 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1408 * android.graphics.Rect) Gravity.apply} and
1409 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1410 * Gravity.applyDisplay} are used during window layout, with this value
1411 * given as the desired gravity. For example you can specify
1412 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
1413 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
1414 * to control the behavior of
1415 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1416 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001417 *
1418 * @see Gravity
1419 */
1420 public int gravity;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001421
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 /**
1423 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001424 * between the container and the widget. See
1425 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1426 * android.graphics.Rect) Gravity.apply} for how this is used. This
1427 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001428 */
1429 public float horizontalMargin;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001430
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001431 /**
1432 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001433 * between the container and the widget. See
1434 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1435 * android.graphics.Rect) Gravity.apply} for how this is used. This
1436 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001437 */
1438 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001439
1440 /**
1441 * Positive insets between the drawing surface and window content.
1442 *
1443 * @hide
1444 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07001445 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08001446
1447 /**
1448 * Whether the surface insets have been manually set. When set to
1449 * {@code false}, the view root will automatically determine the
1450 * appropriate surface insets.
1451 *
1452 * @see #surfaceInsets
1453 * @hide
1454 */
1455 public boolean hasManualSurfaceInsets;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001456
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001457 /**
1458 * The desired bitmap format. May be one of the constants in
1459 * {@link android.graphics.PixelFormat}. Default is OPAQUE.
1460 */
1461 public int format;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001462
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001463 /**
1464 * A style resource defining the animations to use for this window.
1465 * This must be a system resource; it can not be an application resource
1466 * because the window manager does not have access to applications.
1467 */
1468 public int windowAnimations;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001469
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001470 /**
1471 * An alpha value to apply to this entire window.
1472 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1473 */
1474 public float alpha = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001475
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001476 /**
1477 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1478 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1479 * dim.
1480 */
1481 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001482
1483 /**
1484 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1485 * indicating that the brightness value is not overridden for this window
1486 * and normal brightness policy should be used.
1487 */
1488 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1489
1490 /**
1491 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1492 * indicating that the screen or button backlight brightness should be set
1493 * to the lowest value when this window is in front.
1494 */
1495 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1496
1497 /**
1498 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1499 * indicating that the screen or button backlight brightness should be set
1500 * to the hightest value when this window is in front.
1501 */
1502 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001503
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001504 /**
1505 * This can be used to override the user's preferred brightness of
1506 * the screen. A value of less than 0, the default, means to use the
1507 * preferred screen brightness. 0 to 1 adjusts the brightness from
1508 * dark to full bright.
1509 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001510 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001511
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001512 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001513 * This can be used to override the standard behavior of the button and
1514 * keyboard backlights. A value of less than 0, the default, means to
1515 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1516 * from dark to full bright.
1517 */
1518 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1519
1520 /**
Craig Mautner3c174372013-02-21 17:54:37 -08001521 * Value for {@link #rotationAnimation} to define the animation used to
1522 * specify that this window will rotate in or out following a rotation.
1523 */
1524 public static final int ROTATION_ANIMATION_ROTATE = 0;
1525
1526 /**
1527 * Value for {@link #rotationAnimation} to define the animation used to
1528 * specify that this window will fade in or out following a rotation.
1529 */
1530 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
1531
1532 /**
1533 * Value for {@link #rotationAnimation} to define the animation used to
1534 * specify that this window will immediately disappear or appear following
1535 * a rotation.
1536 */
1537 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
1538
1539 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001540 * Define the exit and entry animations used on this window when the device is rotated.
1541 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08001542 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001543 * by other windows. All other situations default to the
1544 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001545 *
Craig Mautner3c174372013-02-21 17:54:37 -08001546 * @see #ROTATION_ANIMATION_ROTATE
1547 * @see #ROTATION_ANIMATION_CROSSFADE
1548 * @see #ROTATION_ANIMATION_JUMPCUT
1549 */
1550 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
1551
1552 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001553 * Identifier for this window. This will usually be filled in for
1554 * you.
1555 */
1556 public IBinder token = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001557
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001558 /**
1559 * Name of the package owning this window.
1560 */
1561 public String packageName = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001562
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001563 /**
1564 * Specific orientation value for a window.
1565 * May be any of the same values allowed
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001566 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1567 * If not set, a default value of
1568 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001569 * will be used.
1570 */
1571 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001572
1573 /**
Michael Wright3f145a22014-07-22 19:46:03 -07001574 * The preferred refresh rate for the window.
1575 *
1576 * This must be one of the supported refresh rates obtained for the display(s) the window
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001577 * is on. The selected refresh rate will be applied to the display's default mode.
1578 *
1579 * This value is ignored if {@link #preferredDisplayModeId} is set.
Michael Wright3f145a22014-07-22 19:46:03 -07001580 *
1581 * @see Display#getSupportedRefreshRates()
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001582 * @deprecated use {@link #preferredDisplayModeId} instead
Michael Wright3f145a22014-07-22 19:46:03 -07001583 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001584 @Deprecated
Michael Wright3f145a22014-07-22 19:46:03 -07001585 public float preferredRefreshRate;
1586
1587 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001588 * Id of the preferred display mode for the window.
1589 * <p>
1590 * This must be one of the supported modes obtained for the display(s) the window is on.
1591 * A value of {@code 0} means no preference.
1592 *
1593 * @see Display#getSupportedModes()
1594 * @see Display.Mode#getModeId()
1595 */
1596 public int preferredDisplayModeId;
1597
1598 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001599 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001600 *
1601 * @see View#STATUS_BAR_VISIBLE
1602 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001603 */
1604 public int systemUiVisibility;
1605
1606 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001607 * @hide
1608 * The ui visibility as requested by the views in this hierarchy.
1609 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1610 */
1611 public int subtreeSystemUiVisibility;
1612
1613 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001614 * Get callbacks about the system ui visibility changing.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001615 *
Joe Onorato664644d2011-01-23 17:53:23 -08001616 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1617 *
1618 * @hide
1619 */
1620 public boolean hasSystemUiListeners;
1621
Jeff Brown474dcb52011-06-14 20:22:50 -07001622 /**
1623 * When this window has focus, disable touch pad pointer gesture processing.
1624 * The window will receive raw position updates from the touch pad instead
1625 * of pointer movements and synthetic touch events.
1626 *
1627 * @hide
1628 */
1629 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1630
1631 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001632 * Does not construct an input channel for this window. The channel will therefore
1633 * be incapable of receiving input.
1634 *
1635 * @hide
1636 */
1637 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1638
1639 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001640 * When this window has focus, does not call user activity for all input events so
1641 * the application will have to do it itself. Should only be used by
1642 * the keyguard and phone app.
1643 * <p>
1644 * Should only be used by the keyguard and phone app.
1645 * </p>
1646 *
1647 * @hide
1648 */
1649 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
1650
1651 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001652 * Control special features of the input subsystem.
1653 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001654 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001655 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001656 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07001657 * @hide
1658 */
1659 public int inputFeatures;
1660
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001661 /**
1662 * Sets the number of milliseconds before the user activity timeout occurs
1663 * when this window has focus. A value of -1 uses the standard timeout.
1664 * A value of 0 uses the minimum support display timeout.
1665 * <p>
1666 * This property can only be used to reduce the user specified display timeout;
1667 * it can never make the timeout longer than it normally would be.
1668 * </p><p>
1669 * Should only be used by the keyguard and phone app.
1670 * </p>
1671 *
1672 * @hide
1673 */
1674 public long userActivityTimeout = -1;
1675
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001676 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001677 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001678 type = TYPE_APPLICATION;
1679 format = PixelFormat.OPAQUE;
1680 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001681
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001682 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001683 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001684 type = _type;
1685 format = PixelFormat.OPAQUE;
1686 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001687
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001688 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001689 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001690 type = _type;
1691 flags = _flags;
1692 format = PixelFormat.OPAQUE;
1693 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001694
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001695 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08001696 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001697 type = _type;
1698 flags = _flags;
1699 format = _format;
1700 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001701
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001702 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
1703 super(w, h);
1704 type = _type;
1705 flags = _flags;
1706 format = _format;
1707 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001708
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001709 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
1710 int _flags, int _format) {
1711 super(w, h);
1712 x = xpos;
1713 y = ypos;
1714 type = _type;
1715 flags = _flags;
1716 format = _format;
1717 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001718
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001719 public final void setTitle(CharSequence title) {
1720 if (null == title)
1721 title = "";
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001722
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001723 mTitle = TextUtils.stringOrSpannedString(title);
1724 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001725
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001726 public final CharSequence getTitle() {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08001727 return mTitle != null ? mTitle : "";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001728 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08001729
1730 /** @hide */
1731 @SystemApi
1732 public final void setUserActivityTimeout(long timeout) {
1733 userActivityTimeout = timeout;
1734 }
1735
1736 /** @hide */
1737 @SystemApi
1738 public final long getUserActivityTimeout() {
1739 return userActivityTimeout;
1740 }
1741
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001742 public int describeContents() {
1743 return 0;
1744 }
1745
1746 public void writeToParcel(Parcel out, int parcelableFlags) {
1747 out.writeInt(width);
1748 out.writeInt(height);
1749 out.writeInt(x);
1750 out.writeInt(y);
1751 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001752 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001753 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001754 out.writeInt(softInputMode);
1755 out.writeInt(gravity);
1756 out.writeFloat(horizontalMargin);
1757 out.writeFloat(verticalMargin);
1758 out.writeInt(format);
1759 out.writeInt(windowAnimations);
1760 out.writeFloat(alpha);
1761 out.writeFloat(dimAmount);
1762 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001763 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08001764 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001765 out.writeStrongBinder(token);
1766 out.writeString(packageName);
1767 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
1768 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07001769 out.writeFloat(preferredRefreshRate);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001770 out.writeInt(preferredDisplayModeId);
Joe Onorato664644d2011-01-23 17:53:23 -08001771 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08001772 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08001773 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07001774 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001775 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07001776 out.writeInt(surfaceInsets.left);
1777 out.writeInt(surfaceInsets.top);
1778 out.writeInt(surfaceInsets.right);
1779 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08001780 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001781 out.writeInt(needsMenuKey);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001782 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001783
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001784 public static final Parcelable.Creator<LayoutParams> CREATOR
1785 = new Parcelable.Creator<LayoutParams>() {
1786 public LayoutParams createFromParcel(Parcel in) {
1787 return new LayoutParams(in);
1788 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001789
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001790 public LayoutParams[] newArray(int size) {
1791 return new LayoutParams[size];
1792 }
1793 };
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001794
1795
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001796 public LayoutParams(Parcel in) {
1797 width = in.readInt();
1798 height = in.readInt();
1799 x = in.readInt();
1800 y = in.readInt();
1801 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001802 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001803 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001804 softInputMode = in.readInt();
1805 gravity = in.readInt();
1806 horizontalMargin = in.readFloat();
1807 verticalMargin = in.readFloat();
1808 format = in.readInt();
1809 windowAnimations = in.readInt();
1810 alpha = in.readFloat();
1811 dimAmount = in.readFloat();
1812 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001813 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08001814 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001815 token = in.readStrongBinder();
1816 packageName = in.readString();
1817 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
1818 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07001819 preferredRefreshRate = in.readFloat();
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001820 preferredDisplayModeId = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001821 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08001822 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001823 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07001824 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001825 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07001826 surfaceInsets.left = in.readInt();
1827 surfaceInsets.top = in.readInt();
1828 surfaceInsets.right = in.readInt();
1829 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08001830 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001831 needsMenuKey = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001832 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001833
Romain Guy72998072009-06-22 11:09:20 -07001834 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001835 public static final int LAYOUT_CHANGED = 1<<0;
1836 public static final int TYPE_CHANGED = 1<<1;
1837 public static final int FLAGS_CHANGED = 1<<2;
1838 public static final int FORMAT_CHANGED = 1<<3;
1839 public static final int ANIMATION_CHANGED = 1<<4;
1840 public static final int DIM_AMOUNT_CHANGED = 1<<5;
1841 public static final int TITLE_CHANGED = 1<<6;
1842 public static final int ALPHA_CHANGED = 1<<7;
1843 public static final int MEMORY_TYPE_CHANGED = 1<<8;
1844 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
1845 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
1846 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08001847 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001848 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001849 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08001850 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001851 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08001852 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001853 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07001854 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001855 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001856 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001857 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07001858 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001859 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001860 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04001861 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
1862 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07001863 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001864 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07001865 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
1866 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001867 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
1868 /** {@hide} */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001869 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23;
1870 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07001871 public static final int EVERYTHING_CHANGED = 0xffffffff;
1872
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001873 // internal buffer to backup/restore parameters under compatibility mode.
1874 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001875
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001876 public final int copyFrom(LayoutParams o) {
1877 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001878
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001879 if (width != o.width) {
1880 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07001881 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001882 }
1883 if (height != o.height) {
1884 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07001885 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001886 }
1887 if (x != o.x) {
1888 x = o.x;
1889 changes |= LAYOUT_CHANGED;
1890 }
1891 if (y != o.y) {
1892 y = o.y;
1893 changes |= LAYOUT_CHANGED;
1894 }
1895 if (horizontalWeight != o.horizontalWeight) {
1896 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001897 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001898 }
1899 if (verticalWeight != o.verticalWeight) {
1900 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001901 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001902 }
1903 if (horizontalMargin != o.horizontalMargin) {
1904 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001905 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001906 }
1907 if (verticalMargin != o.verticalMargin) {
1908 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001909 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001910 }
1911 if (type != o.type) {
1912 type = o.type;
1913 changes |= TYPE_CHANGED;
1914 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001915 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04001916 final int diff = flags ^ o.flags;
1917 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
1918 changes |= TRANSLUCENT_FLAGS_CHANGED;
1919 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001920 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07001921 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001922 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001923 if (privateFlags != o.privateFlags) {
1924 privateFlags = o.privateFlags;
1925 changes |= PRIVATE_FLAGS_CHANGED;
1926 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001927 if (softInputMode != o.softInputMode) {
1928 softInputMode = o.softInputMode;
1929 changes |= SOFT_INPUT_MODE_CHANGED;
1930 }
1931 if (gravity != o.gravity) {
1932 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07001933 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001934 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001935 if (format != o.format) {
1936 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07001937 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001938 }
1939 if (windowAnimations != o.windowAnimations) {
1940 windowAnimations = o.windowAnimations;
1941 changes |= ANIMATION_CHANGED;
1942 }
1943 if (token == null) {
1944 // NOTE: token only copied if the recipient doesn't
1945 // already have one.
1946 token = o.token;
1947 }
1948 if (packageName == null) {
1949 // NOTE: packageName only copied if the recipient doesn't
1950 // already have one.
1951 packageName = o.packageName;
1952 }
Wale Ogunwale1f240c92016-02-22 18:04:58 -08001953 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08001954 // NOTE: mTitle only copied if the originator set one.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001955 mTitle = o.mTitle;
1956 changes |= TITLE_CHANGED;
1957 }
1958 if (alpha != o.alpha) {
1959 alpha = o.alpha;
1960 changes |= ALPHA_CHANGED;
1961 }
1962 if (dimAmount != o.dimAmount) {
1963 dimAmount = o.dimAmount;
1964 changes |= DIM_AMOUNT_CHANGED;
1965 }
1966 if (screenBrightness != o.screenBrightness) {
1967 screenBrightness = o.screenBrightness;
1968 changes |= SCREEN_BRIGHTNESS_CHANGED;
1969 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001970 if (buttonBrightness != o.buttonBrightness) {
1971 buttonBrightness = o.buttonBrightness;
1972 changes |= BUTTON_BRIGHTNESS_CHANGED;
1973 }
Craig Mautner3c174372013-02-21 17:54:37 -08001974 if (rotationAnimation != o.rotationAnimation) {
1975 rotationAnimation = o.rotationAnimation;
1976 changes |= ROTATION_ANIMATION_CHANGED;
1977 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001978
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001979 if (screenOrientation != o.screenOrientation) {
1980 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07001981 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001982 }
Romain Guy529b60a2010-08-03 18:05:47 -07001983
Michael Wright3f145a22014-07-22 19:46:03 -07001984 if (preferredRefreshRate != o.preferredRefreshRate) {
1985 preferredRefreshRate = o.preferredRefreshRate;
1986 changes |= PREFERRED_REFRESH_RATE_CHANGED;
1987 }
1988
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001989 if (preferredDisplayModeId != o.preferredDisplayModeId) {
1990 preferredDisplayModeId = o.preferredDisplayModeId;
1991 changes |= PREFERRED_DISPLAY_MODE_ID;
1992 }
1993
Joe Onorato14782f72011-01-25 19:53:17 -08001994 if (systemUiVisibility != o.systemUiVisibility
1995 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08001996 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08001997 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08001998 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
1999 }
2000
2001 if (hasSystemUiListeners != o.hasSystemUiListeners) {
2002 hasSystemUiListeners = o.hasSystemUiListeners;
2003 changes |= SYSTEM_UI_LISTENER_CHANGED;
2004 }
2005
Jeff Brown474dcb52011-06-14 20:22:50 -07002006 if (inputFeatures != o.inputFeatures) {
2007 inputFeatures = o.inputFeatures;
2008 changes |= INPUT_FEATURES_CHANGED;
2009 }
2010
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002011 if (userActivityTimeout != o.userActivityTimeout) {
2012 userActivityTimeout = o.userActivityTimeout;
2013 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
2014 }
2015
Alan Viverette49a22e82014-07-12 20:01:27 -07002016 if (!surfaceInsets.equals(o.surfaceInsets)) {
2017 surfaceInsets.set(o.surfaceInsets);
2018 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002019 }
2020
Alan Viverette5435a302015-01-29 10:25:34 -08002021 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
2022 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
2023 changes |= SURFACE_INSETS_CHANGED;
2024 }
2025
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002026 if (needsMenuKey != o.needsMenuKey) {
2027 needsMenuKey = o.needsMenuKey;
2028 changes |= NEEDS_MENU_KEY_CHANGED;
2029 }
2030
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002031 return changes;
2032 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002033
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002034 @Override
2035 public String debug(String output) {
2036 output += "Contents of " + this + ":";
2037 Log.d("Debug", output);
2038 output = super.debug("");
2039 Log.d("Debug", output);
2040 Log.d("Debug", "");
2041 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
2042 return "";
2043 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002044
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002045 @Override
2046 public String toString() {
2047 StringBuilder sb = new StringBuilder(256);
2048 sb.append("WM.LayoutParams{");
2049 sb.append("(");
2050 sb.append(x);
2051 sb.append(',');
2052 sb.append(y);
2053 sb.append(")(");
Romain Guy980a9382010-01-08 15:06:28 -08002054 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002055 sb.append('x');
Romain Guy980a9382010-01-08 15:06:28 -08002056 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002057 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002058 if (horizontalMargin != 0) {
2059 sb.append(" hm=");
2060 sb.append(horizontalMargin);
2061 }
2062 if (verticalMargin != 0) {
2063 sb.append(" vm=");
2064 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002065 }
2066 if (gravity != 0) {
2067 sb.append(" gr=#");
2068 sb.append(Integer.toHexString(gravity));
2069 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002070 if (softInputMode != 0) {
2071 sb.append(" sim=#");
2072 sb.append(Integer.toHexString(softInputMode));
2073 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002074 sb.append(" ty=");
2075 sb.append(type);
2076 sb.append(" fl=#");
2077 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002078 if (privateFlags != 0) {
Adam Lesinski95c42972013-10-02 10:13:27 -07002079 if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
2080 sb.append(" compatible=true");
2081 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002082 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
2083 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07002084 if (format != PixelFormat.OPAQUE) {
2085 sb.append(" fmt=");
2086 sb.append(format);
2087 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002088 if (windowAnimations != 0) {
2089 sb.append(" wanim=0x");
2090 sb.append(Integer.toHexString(windowAnimations));
2091 }
2092 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
2093 sb.append(" or=");
2094 sb.append(screenOrientation);
2095 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002096 if (alpha != 1.0f) {
2097 sb.append(" alpha=");
2098 sb.append(alpha);
2099 }
2100 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
2101 sb.append(" sbrt=");
2102 sb.append(screenBrightness);
2103 }
2104 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
2105 sb.append(" bbrt=");
2106 sb.append(buttonBrightness);
2107 }
Craig Mautner3c174372013-02-21 17:54:37 -08002108 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
2109 sb.append(" rotAnim=");
2110 sb.append(rotationAnimation);
2111 }
Michael Wright3f145a22014-07-22 19:46:03 -07002112 if (preferredRefreshRate != 0) {
2113 sb.append(" preferredRefreshRate=");
2114 sb.append(preferredRefreshRate);
2115 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002116 if (preferredDisplayModeId != 0) {
2117 sb.append(" preferredDisplayMode=");
2118 sb.append(preferredDisplayModeId);
2119 }
Joe Onorato664644d2011-01-23 17:53:23 -08002120 if (systemUiVisibility != 0) {
2121 sb.append(" sysui=0x");
2122 sb.append(Integer.toHexString(systemUiVisibility));
2123 }
Joe Onorato14782f72011-01-25 19:53:17 -08002124 if (subtreeSystemUiVisibility != 0) {
2125 sb.append(" vsysui=0x");
2126 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
2127 }
Joe Onorato664644d2011-01-23 17:53:23 -08002128 if (hasSystemUiListeners) {
2129 sb.append(" sysuil=");
2130 sb.append(hasSystemUiListeners);
2131 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07002132 if (inputFeatures != 0) {
2133 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
2134 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002135 if (userActivityTimeout >= 0) {
2136 sb.append(" userActivityTimeout=").append(userActivityTimeout);
2137 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07002138 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Andreas Gampe11090062015-03-16 09:45:34 -07002139 surfaceInsets.bottom != 0 || hasManualSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07002140 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08002141 if (hasManualSurfaceInsets) {
2142 sb.append(" (manual)");
2143 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07002144 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002145 if (needsMenuKey != NEEDS_MENU_UNSET) {
2146 sb.append(" needsMenuKey=");
2147 sb.append(needsMenuKey);
2148 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002149 sb.append('}');
2150 return sb.toString();
2151 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002152
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002153 /**
2154 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002155 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002156 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002157 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002158 x = (int) (x * scale + 0.5f);
2159 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002160 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002161 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002162 }
2163 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002164 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002165 }
2166 }
2167
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002168 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002169 * Backup the layout parameters used in compatibility mode.
2170 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002171 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002172 void backup() {
2173 int[] backup = mCompatibilityParamsBackup;
2174 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002175 // we backup 4 elements, x, y, width, height
2176 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002177 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002178 backup[0] = x;
2179 backup[1] = y;
2180 backup[2] = width;
2181 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002182 }
2183
2184 /**
2185 * Restore the layout params' coordinates, size and gravity
2186 * @see LayoutParams#backup()
2187 */
2188 void restore() {
2189 int[] backup = mCompatibilityParamsBackup;
2190 if (backup != null) {
2191 x = backup[0];
2192 y = backup[1];
2193 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002194 height = backup[3];
2195 }
2196 }
2197
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002198 private CharSequence mTitle = null;
Siva Velusamy0d857b92015-04-22 10:23:56 -07002199
2200 /** @hide */
2201 @Override
2202 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
2203 super.encodeProperties(encoder);
2204
2205 encoder.addProperty("x", x);
2206 encoder.addProperty("y", y);
2207 encoder.addProperty("horizontalWeight", horizontalWeight);
2208 encoder.addProperty("verticalWeight", verticalWeight);
2209 encoder.addProperty("type", type);
2210 encoder.addProperty("flags", flags);
2211 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002212 }
2213}