blob: 66dae7b0e5dda7664db897030914180d3b271aba [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.view;
18
Bryce Lee53b9fbd2015-02-06 12:06:34 -080019import android.annotation.SystemApi;
Jeff Browna492c3a2012-08-23 19:48:44 -070020import android.app.Presentation;
21import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.pm.ActivityInfo;
Alan Viveretteccb11e12014-07-08 16:04:02 -070023import android.graphics.Insets;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.graphics.PixelFormat;
Alan Viveretteccb11e12014-07-08 16:04:02 -070025import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.os.IBinder;
27import android.os.Parcel;
28import android.os.Parcelable;
29import android.text.TextUtils;
30import android.util.Log;
31
32
33/**
34 * The interface that apps use to talk to the window manager.
35 * <p>
36 * Use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> to get one of these.
Jeff Browna492c3a2012-08-23 19:48:44 -070037 * </p><p>
38 * Each window manager instance is bound to a particular {@link Display}.
39 * To obtain a {@link WindowManager} for a different display, use
40 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
41 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
42 * to get the WindowManager.
43 * </p><p>
44 * The simplest way to show a window on another display is to create a
45 * {@link Presentation}. The presentation will automatically obtain a
46 * {@link WindowManager} and {@link Context} for that display.
47 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048 *
49 * @see android.content.Context#getSystemService
50 * @see android.content.Context#WINDOW_SERVICE
51 */
52public interface WindowManager extends ViewManager {
53 /**
54 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +010055 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 * is invalid.
57 */
58 public static class BadTokenException extends RuntimeException {
59 public BadTokenException() {
60 }
61
62 public BadTokenException(String name) {
63 super(name);
64 }
65 }
66
67 /**
Craig Mautner6018aee2012-10-23 14:27:49 -070068 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
69 * be found. See {@link android.app.Presentation} for more information on secondary displays.
70 */
71 public static class InvalidDisplayException extends RuntimeException {
72 public InvalidDisplayException() {
73 }
74
75 public InvalidDisplayException(String name) {
76 super(name);
77 }
78 }
79
80 /**
Jeff Browna492c3a2012-08-23 19:48:44 -070081 * Returns the {@link Display} upon which this {@link WindowManager} instance
82 * will create new windows.
83 * <p>
84 * Despite the name of this method, the display that is returned is not
85 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
86 * The returned display could instead be a secondary display that this
87 * window manager instance is managing. Think of it as the display that
88 * this {@link WindowManager} instance uses by default.
89 * </p><p>
90 * To create windows on a different display, you need to obtain a
91 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
92 * class documentation for more information.)
93 * </p>
94 *
95 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 */
97 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -070098
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 /**
100 * Special variation of {@link #removeView} that immediately invokes
101 * the given view hierarchy's {@link View#onDetachedFromWindow()
102 * View.onDetachedFromWindow()} methods before returning. This is not
103 * for normal applications; using it correctly requires great care.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000104 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 * @param view The view to be removed.
106 */
107 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700108
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 public static class LayoutParams extends ViewGroup.LayoutParams
110 implements Parcelable {
111 /**
112 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700113 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
114 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 */
Romain Guy529b60a2010-08-03 18:05:47 -0700116 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 public int x;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000118
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800119 /**
120 * Y position for this window. With the default gravity it is ignored.
121 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
122 * an offset from the given edge.
123 */
Romain Guy529b60a2010-08-03 18:05:47 -0700124 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800125 public int y;
126
127 /**
128 * Indicates how much of the extra space will be allocated horizontally
129 * to the view associated with these LayoutParams. Specify 0 if the view
130 * should not be stretched. Otherwise the extra pixels will be pro-rated
131 * among all views whose weight is greater than 0.
132 */
Romain Guy529b60a2010-08-03 18:05:47 -0700133 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 public float horizontalWeight;
135
136 /**
137 * Indicates how much of the extra space will be allocated vertically
138 * to the view associated with these LayoutParams. Specify 0 if the view
139 * should not be stretched. Otherwise the extra pixels will be pro-rated
140 * among all views whose weight is greater than 0.
141 */
Romain Guy529b60a2010-08-03 18:05:47 -0700142 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700144
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800145 /**
146 * The general type of window. There are three main classes of
147 * window types:
148 * <ul>
149 * <li> <strong>Application windows</strong> (ranging from
150 * {@link #FIRST_APPLICATION_WINDOW} to
151 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
152 * windows. For these types of windows, the {@link #token} must be
153 * set to the token of the activity they are a part of (this will
154 * normally be done for you if {@link #token} is null).
155 * <li> <strong>Sub-windows</strong> (ranging from
156 * {@link #FIRST_SUB_WINDOW} to
157 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
158 * window. For these types of windows, the {@link #token} must be
159 * the token of the window it is attached to.
160 * <li> <strong>System windows</strong> (ranging from
161 * {@link #FIRST_SYSTEM_WINDOW} to
162 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
163 * use by the system for specific purposes. They should not normally
164 * be used by applications, and a special permission is required
165 * to use them.
166 * </ul>
Wonsik Kim475e3f02014-03-17 11:17:47 +0000167 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800168 * @see #TYPE_BASE_APPLICATION
169 * @see #TYPE_APPLICATION
170 * @see #TYPE_APPLICATION_STARTING
171 * @see #TYPE_APPLICATION_PANEL
172 * @see #TYPE_APPLICATION_MEDIA
173 * @see #TYPE_APPLICATION_SUB_PANEL
174 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
175 * @see #TYPE_STATUS_BAR
176 * @see #TYPE_SEARCH_BAR
177 * @see #TYPE_PHONE
178 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800179 * @see #TYPE_TOAST
180 * @see #TYPE_SYSTEM_OVERLAY
181 * @see #TYPE_PRIORITY_PHONE
182 * @see #TYPE_STATUS_BAR_PANEL
183 * @see #TYPE_SYSTEM_DIALOG
184 * @see #TYPE_KEYGUARD_DIALOG
185 * @see #TYPE_SYSTEM_ERROR
186 * @see #TYPE_INPUT_METHOD
187 * @see #TYPE_INPUT_METHOD_DIALOG
188 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700189 @ViewDebug.ExportedProperty(mapping = {
190 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
191 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
192 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
193 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
194 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
195 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
196 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700197 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700198 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
199 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
200 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
201 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700202 @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
203 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
204 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700205 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"),
206 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
207 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
208 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
Jeff Brown3b2b3542010-10-15 00:54:27 -0700209 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700210 @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
211 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700212 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700213 @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
214 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
215 @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
216 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
217 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700218 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
219 @ViewDebug.IntToString(from = TYPE_HIDDEN_NAV_CONSUMER, to = "TYPE_HIDDEN_NAV_CONSUMER"),
220 @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
Jeff Brownbd6e1502012-08-28 03:27:37 -0700221 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"),
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700222 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"),
keunyounga446bf02013-06-21 19:07:57 -0700223 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY"),
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700224 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION"),
225 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, to = "TYPE_VOICE_INTERACTION"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700226 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800227 public int type;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000228
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800229 /**
230 * Start of window types that represent normal application windows.
231 */
232 public static final int FIRST_APPLICATION_WINDOW = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800234 /**
235 * Window type: an application window that serves as the "base" window
236 * of the overall application; all other application windows will
237 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700238 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239 */
240 public static final int TYPE_BASE_APPLICATION = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000241
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800242 /**
243 * Window type: a normal application window. The {@link #token} must be
244 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700245 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800246 */
247 public static final int TYPE_APPLICATION = 2;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800249 /**
250 * Window type: special application window that is displayed while the
251 * application is starting. Not for use by applications themselves;
252 * this is used by the system to display something until the
253 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700254 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 */
256 public static final int TYPE_APPLICATION_STARTING = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800258 /**
259 * End of types of application windows.
260 */
261 public static final int LAST_APPLICATION_WINDOW = 99;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000262
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800263 /**
264 * Start of types of sub-windows. The {@link #token} of these windows
265 * must be set to the window they are attached to. These types of
266 * windows are kept next to their attached window in Z-order, and their
267 * coordinate space is relative to their attached window.
268 */
269 public static final int FIRST_SUB_WINDOW = 1000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000270
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800271 /**
272 * Window type: a panel on top of an application window. These windows
273 * appear on top of their attached window.
274 */
275 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000276
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800277 /**
John Spurlock33291d82013-03-13 14:45:14 -0400278 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800279 * are displayed behind their attached window.
280 */
281 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000282
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 /**
284 * Window type: a sub-panel on top of an application window. These
285 * windows are displayed on top their attached window and any
286 * {@link #TYPE_APPLICATION_PANEL} panels.
287 */
288 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW+2;
289
290 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
291 * of the window happens as that of a top-level window, <em>not</em>
292 * as a child of its container.
293 */
294 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000295
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800296 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700297 * Window type: window for showing overlays on top of media windows.
298 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
299 * application window. They should be translucent to be useful. This
300 * is a big ugly hack so:
301 * @hide
302 */
303 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000304
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700305 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306 * End of types of sub-windows.
307 */
308 public static final int LAST_SUB_WINDOW = 1999;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000309
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800310 /**
311 * Start of system-specific window types. These are not normally
312 * created by applications.
313 */
314 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 /**
317 * Window type: the status bar. There can be only one status bar
318 * window; it is placed at the top of the screen, and all other
319 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700320 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800321 */
322 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000323
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800324 /**
325 * Window type: the search bar. There can be only one search bar
326 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700327 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800328 */
329 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000330
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800331 /**
332 * Window type: phone. These are non-application windows providing
333 * user interaction with the phone (in particular incoming calls).
334 * These windows are normally placed above all applications, but behind
335 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700336 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800337 */
338 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800340 /**
341 * Window type: system window, such as low power alert. These windows
342 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700343 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344 */
345 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100346
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347 /**
348 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700349 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200350 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 */
352 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100353
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 /**
355 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700356 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800357 */
358 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000359
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800360 /**
361 * Window type: system overlay windows, which need to be displayed
362 * on top of everything else. These windows must not take input
363 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700364 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800365 */
366 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000367
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800368 /**
369 * Window type: priority phone UI, which needs to be displayed even if
370 * the keyguard is active. These windows must not take input
371 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700372 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800373 */
374 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000375
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800376 /**
377 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700378 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800379 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000381
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800382 /**
383 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700384 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 */
386 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000387
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800388 /**
389 * Window type: internal system error windows, appear on top of
390 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700391 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 */
393 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000394
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800395 /**
396 * Window type: internal input methods windows, which appear above
397 * the normal UI. Application windows may be resized or panned to keep
398 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700399 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 */
401 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
402
403 /**
404 * Window type: internal input methods dialog windows, which appear above
405 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700406 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800407 */
408 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
409
410 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700411 * Window type: wallpaper window, placed behind any window that wants
412 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700413 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700414 */
415 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
416
417 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800418 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700419 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800420 */
421 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700422
423 /**
424 * Window type: secure system overlay windows, which need to be displayed
425 * on top of everything else. These windows must not take input
426 * focus, or they will interfere with the keyguard.
427 *
428 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
429 * system itself is allowed to create these overlays. Applications cannot
430 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700431 *
432 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700433 * @hide
434 */
435 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
436
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800437 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700438 * Window type: the drag-and-drop pseudowindow. There is only one
439 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700440 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700441 * @hide
442 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700443 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700444
445 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800446 * Window type: panel that slides out from under the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700447 * In multiuser systems shows on all users' windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800448 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800449 */
450 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
451
Jeff Brown83c09682010-12-23 17:50:18 -0800452 /**
453 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700454 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800455 * @hide
456 */
457 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800458
459 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400460 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700461 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400462 * @hide
463 */
464 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
465
466 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700467 * Window type: The volume level overlay/dialog shown when the user
468 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700469 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700470 * @hide
471 */
472 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
473
474 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700475 * Window type: The boot progress dialog, goes on top of everything
476 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700477 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700478 * @hide
479 */
480 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
481
482 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700483 * Window type: Fake window to consume touch events when the navigation
484 * bar is hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700485 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700486 * @hide
487 */
488 public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22;
489
490 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500491 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700492 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500493 * @hide
494 */
495 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
496
497 /**
Jim Millere898ac52012-04-06 17:10:57 -0700498 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700499 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700500 * @hide
501 */
502 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
503
504 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700505 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700506 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700507 * @hide
508 */
509 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
510
511 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700512 * Window type: Magnification overlay window. Used to highlight the magnified
513 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -0700514 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700515 * @hide
516 */
517 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
518
519 /**
Jim Miller5ecd8112013-01-09 18:50:26 -0800520 * Window type: keyguard scrim window. Shows if keyguard needs to be restarted.
521 * In multiuser systems shows on all users' windows.
522 * @hide
523 */
524 public static final int TYPE_KEYGUARD_SCRIM = FIRST_SYSTEM_WINDOW+29;
525
Craig Mautner88400d32012-09-30 12:35:45 -0700526 /**
keunyounga446bf02013-06-21 19:07:57 -0700527 * Window type: Window for Presentation on top of private
528 * virtual display.
529 */
530 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
531
532 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700533 * Window type: Windows in the voice interaction layer.
534 * @hide
535 */
536 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
537
538 /**
Svetoslav3a5c7212014-10-14 09:54:26 -0700539 * Window type: Windows that are overlaid <em>only</em> by an {@link
540 * android.accessibilityservice.AccessibilityService} for interception of
541 * user interactions without changing the windows an accessibility service
542 * can introspect. In particular, an accessibility service can introspect
543 * only windows that a sighted user can interact with which is they can touch
544 * these windows or can type into these windows. For example, if there
545 * is a full screen accessibility overlay that is touchable, the windows
546 * below it will be introspectable by an accessibility service regardless
547 * they are covered by a touchable window.
548 */
549 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
550
551 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 * End of types of system windows.
553 */
554 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800555
Mathias Agopiand2112302010-12-07 19:38:17 -0800556 /** @deprecated this is ignored, this value is set automatically when needed. */
557 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800558 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800559 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700560 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800561 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800562 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700563 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800564 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800565 /** @deprecated this is ignored, this value is set automatically when needed. */
566 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800567 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000568
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800569 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700570 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800571 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700572 @Deprecated
573 public int memoryType;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000574
Mike Lockwoodef731622010-01-27 17:51:34 -0500575 /** Window flag: as long as this window is visible to the user, allow
Wonsik Kim475e3f02014-03-17 11:17:47 +0000576 * the lock screen to activate while the screen is on.
577 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800578 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500579 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
580
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800581 /** Window flag: everything behind this window will be dimmed.
582 * Use {@link #dimAmount} to control the amount of dim. */
583 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700584
585 /** Window flag: blur everything behind this window.
586 * @deprecated Blurring is no longer supported. */
587 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800588 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700589
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800590 /** Window flag: this window won't ever get key input focus, so the
591 * user can not send key or other button events to it. Those will
592 * instead go to whatever focusable window is behind it. This flag
593 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
594 * is explicitly set.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000595 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800596 * <p>Setting this flag also implies that the window will not need to
597 * interact with
Wonsik Kim475e3f02014-03-17 11:17:47 +0000598 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800599 * independently of any active input method (typically this means it
600 * gets Z-ordered on top of the input method, so it can use the full
601 * screen for its content and cover the input method if needed. You
602 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
603 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000604
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800605 /** Window flag: this window can never receive touch events. */
606 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000607
John Spurlock33291d82013-03-13 14:45:14 -0400608 /** Window flag: even when this window is focusable (its
609 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800610 * outside of the window to be sent to the windows behind it. Otherwise
611 * it will consume all pointer events itself, regardless of whether they
612 * are inside of the window. */
613 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000614
John Spurlock33291d82013-03-13 14:45:14 -0400615 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800616 * screen is pressed, you will receive this first touch event. Usually
617 * the first touch event is consumed by the system since the user can
618 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -0700619 *
620 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 */
Jeff Brown037c33e2014-04-09 00:31:55 -0700622 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000624
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800625 /** Window flag: as long as this window is visible to the user, keep
626 * the device's screen turned on and bright. */
627 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000628
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800629 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -0400630 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800631 * window must correctly position its contents to take the screen
632 * decoration into account. This flag is normally set for you
633 * by Window as described in {@link Window#setFlags}. */
634 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000635
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800636 /** Window flag: allow window to extend outside of the screen. */
637 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000638
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800639 /**
John Spurlock33291d82013-03-13 14:45:14 -0400640 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800641 * this window is displayed. This allows the window to use the entire
642 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -0700643 * an app window with this flag set is on the top layer. A fullscreen window
644 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
645 * {@link #softInputMode} field; the window will stay fullscreen
646 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800647 *
648 * <p>This flag can be controlled in your theme through the
649 * {@link android.R.attr#windowFullscreen} attribute; this attribute
650 * is automatically set for you in the standard fullscreen themes
651 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
652 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
653 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
654 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
655 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
656 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
657 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
658 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800659 public static final int FLAG_FULLSCREEN = 0x00000400;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000660
John Spurlock33291d82013-03-13 14:45:14 -0400661 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
662 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800663 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700666 * the screen.
667 * @deprecated This flag is no longer used. */
668 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800669 public static final int FLAG_DITHER = 0x00001000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000670
John Spurlock33291d82013-03-13 14:45:14 -0400671 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -0700672 * it from appearing in screenshots or from being viewed on non-secure
673 * displays.
674 *
675 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
676 * secure surfaces and secure displays.
677 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 public static final int FLAG_SECURE = 0x00002000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000679
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800680 /** Window flag: a special mode where the layout parameters are used
681 * to perform scaling of the surface when it is composited to the
682 * screen. */
683 public static final int FLAG_SCALED = 0x00004000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000684
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800685 /** Window flag: intended for windows that will often be used when the user is
686 * holding the screen against their face, it will aggressively filter the event
687 * stream to prevent unintended presses in this situation that may not be
Wonsik Kim475e3f02014-03-17 11:17:47 +0000688 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800689 * application will receive a CANCEL motion event to indicate this so applications
Wonsik Kim475e3f02014-03-17 11:17:47 +0000690 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800691 * until the finger is released. */
692 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 /** Window flag: a special option only for use in combination with
695 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
696 * screen your window may appear on top of or behind screen decorations
697 * such as the status bar. By also including this flag, the window
698 * manager will report the inset rectangle needed to ensure your
699 * content is not covered by screen decorations. This flag is normally
700 * set for you by Window as described in {@link Window#setFlags}.*/
701 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000702
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
704 * respect to how this window interacts with the current method. That
705 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
706 * window will behave as if it needs to interact with the input method
707 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
708 * not set and this flag is set, then the window will behave as if it
709 * doesn't need to interact with the input method and can be placed
710 * to use more space and cover the input method.
711 */
712 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000713
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800714 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
715 * can set this flag to receive a single special MotionEvent with
716 * the action
717 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
718 * touches that occur outside of your window. Note that you will not
719 * receive the full down/move/up gesture, only the location of the
720 * first down as an ACTION_OUTSIDE.
721 */
722 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000723
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700724 /** Window flag: special flag to let windows be shown when the screen
725 * is locked. This will let application windows take precedence over
726 * key guard or any other lock screens. Can be used with
727 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700728 * directly before showing the key guard window. Can be used with
729 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
730 * non-secure keyguards. This flag only applies to the top-most
731 * full-screen window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700732 */
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700733 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
734
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700735 /** Window flag: ask that the system wallpaper be shown behind
736 * your window. The window surface must be translucent to be able
737 * to actually see the wallpaper behind it; this flag just ensures
738 * that the wallpaper surface will be there if this window actually
739 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800740 *
741 * <p>This flag can be controlled in your theme through the
742 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
743 * is automatically set for you in the standard wallpaper themes
744 * such as {@link android.R.style#Theme_Wallpaper},
745 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
746 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
747 * {@link android.R.style#Theme_Holo_Wallpaper},
748 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
749 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
750 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700751 */
752 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000753
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700754 /** Window flag: when set as a window is being added or made
755 * visible, once the window has been shown then the system will
756 * poke the power manager's user activity (as if the user had woken
757 * up the device) to turn the screen on. */
758 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000759
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700760 /** Window flag: when set the window will cause the keyguard to
761 * be dismissed, only if it is not a secure lock keyguard. Because such
762 * a keyguard is not needed for security, it will never re-appear if
763 * the user navigates to another window (in contrast to
764 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
765 * hide both secure and non-secure keyguards but ensure they reappear
766 * when the user moves to another UI that doesn't hide them).
767 * If the keyguard is currently active and is secure (requires an
768 * unlock pattern) than the user will still need to confirm it before
769 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
Daniel Sandlerae069f72010-06-17 21:56:26 -0400770 * also been set.
771 */
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700772 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000773
Jeff Brown01ce2e92010-09-26 22:20:12 -0700774 /** Window flag: when set the window will accept for touch events
775 * outside of its bounds to be sent to other windows that also
776 * support split touch. When this flag is not set, the first pointer
777 * that goes down determines the window to which all subsequent touches
778 * go until all pointers go up. When this flag is set, each pointer
779 * (not necessarily the first) that goes down determines the window
780 * to which all subsequent touches of that pointer will go until that
781 * pointer goes up thereby enabling touches with multiple pointers
782 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800783 */
Jeff Brown01ce2e92010-09-26 22:20:12 -0700784 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000785
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800786 /**
Romain Guy72f0a272011-01-09 16:01:46 -0800787 * <p>Indicates whether this window should be hardware accelerated.
788 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800789 *
Romain Guy72f0a272011-01-09 16:01:46 -0800790 * <p>This flag can be controlled programmatically <em>only</em> to enable
791 * hardware acceleration. To enable hardware acceleration for a given
792 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800793 *
Romain Guy72f0a272011-01-09 16:01:46 -0800794 * <pre>
795 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
796 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
797 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
798 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800799 *
Romain Guy72f0a272011-01-09 16:01:46 -0800800 * <p>It is important to remember that this flag <strong>must</strong>
801 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800802 *
Romain Guy72f0a272011-01-09 16:01:46 -0800803 * <p>This flag cannot be used to disable hardware acceleration after it
804 * was enabled in your manifest using
805 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
806 * and programmatically disable hardware acceleration (for automated testing
807 * for instance), make sure it is turned off in your manifest and enable it
808 * on your activity or dialog when you need it instead, using the method
809 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800810 *
Romain Guy72f0a272011-01-09 16:01:46 -0800811 * <p>This flag is automatically set by the system if the
812 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
813 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800814 */
815 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -0400816
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800817 /**
818 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -0800819 * overscan area, if there is one. The window should still correctly
820 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800821 *
822 * <p>This flag can be controlled in your theme through the
823 * {@link android.R.attr#windowOverscan} attribute; this attribute
824 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -0700825 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800826 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
827 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
828 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
829 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
830 *
831 * <p>When this flag is enabled for a window, its normal content may be obscured
832 * to some degree by the overscan region of the display. To ensure key parts of
833 * that content are visible to the user, you can use
834 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
835 * to set the point in the view hierarchy where the appropriate offsets should
836 * be applied. (This can be done either by directly calling this function, using
837 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
838 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
839 * View.fitSystemWindows(Rect)} method).</p>
840 *
841 * <p>This mechanism for positioning content elements is identical to its equivalent
842 * use with layout and {@link View#setSystemUiVisibility(int)
843 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
844 * position its UI elements with this overscan flag is set:</p>
845 *
846 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -0800847 */
848 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
849
John Spurlockbd957402013-10-03 11:38:39 -0400850 /**
851 * Window flag: request a translucent status bar with minimal system-provided
852 * background protection.
853 *
854 * <p>This flag can be controlled in your theme through the
855 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
856 * is automatically set for you in the standard translucent decor themes
857 * such as
858 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
859 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
860 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
861 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
862 *
863 * <p>When this flag is enabled for a window, it automatically sets
864 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
865 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
866 */
867 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
868
869 /**
870 * Window flag: request a translucent navigation bar with minimal system-provided
871 * background protection.
872 *
873 * <p>This flag can be controlled in your theme through the
874 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
875 * is automatically set for you in the standard translucent decor themes
876 * such as
877 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
878 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
879 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
880 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
881 *
882 * <p>When this flag is enabled for a window, it automatically sets
883 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
884 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
885 */
886 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
887
Adam Lesinski6a591f52013-10-01 18:11:17 -0700888 /**
889 * Flag for a window in local focus mode.
890 * Window in local focus mode can control focus independent of window manager using
891 * {@link Window#setLocalFocus(boolean, boolean)}.
892 * Usually window in this mode will not get touch/key events from window manager, but will
893 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
894 */
895 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
896
Jeff Brown98db5fa2011-06-08 15:37:10 -0700897 /** Window flag: Enable touches to slide out of a window into neighboring
898 * windows in mid-gesture instead of being captured for the duration of
899 * the gesture.
900 *
901 * This flag changes the behavior of touch focus for this window only.
902 * Touches can slide out of the window but they cannot necessarily slide
903 * back in (unless the other window with touch focus permits it).
904 *
905 * {@hide}
906 */
Adam Lesinski6a591f52013-10-01 18:11:17 -0700907 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -0700908
Daniel Sandlere02d8082010-10-08 15:13:22 -0400909 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -0700910 * Window flag: When requesting layout with an attached window, the attached window may
911 * overlap with the screen decorations of the parent window such as the navigation bar. By
912 * including this flag, the window manager will layout the attached window within the decor
913 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -0400914 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -0700915 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -0400916
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 /**
Adrian Roos217ccd22014-05-09 14:29:04 +0200918 * Flag indicating that this Window is responsible for drawing the background for the
919 * system bars. If set, the system bars are drawn with a transparent background and the
920 * corresponding areas in this window are filled with the colors specified in
921 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
922 */
923 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
924
925 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700926 * Various behavioral options/flags. Default is none.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000927 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700928 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
929 * @see #FLAG_DIM_BEHIND
930 * @see #FLAG_NOT_FOCUSABLE
931 * @see #FLAG_NOT_TOUCHABLE
932 * @see #FLAG_NOT_TOUCH_MODAL
933 * @see #FLAG_TOUCHABLE_WHEN_WAKING
934 * @see #FLAG_KEEP_SCREEN_ON
935 * @see #FLAG_LAYOUT_IN_SCREEN
936 * @see #FLAG_LAYOUT_NO_LIMITS
937 * @see #FLAG_FULLSCREEN
938 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700939 * @see #FLAG_SECURE
940 * @see #FLAG_SCALED
941 * @see #FLAG_IGNORE_CHEEK_PRESSES
942 * @see #FLAG_LAYOUT_INSET_DECOR
943 * @see #FLAG_ALT_FOCUSABLE_IM
944 * @see #FLAG_WATCH_OUTSIDE_TOUCH
945 * @see #FLAG_SHOW_WHEN_LOCKED
946 * @see #FLAG_SHOW_WALLPAPER
947 * @see #FLAG_TURN_SCREEN_ON
948 * @see #FLAG_DISMISS_KEYGUARD
949 * @see #FLAG_SPLIT_TOUCH
950 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -0700951 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +0200952 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700953 */
954 @ViewDebug.ExportedProperty(flagMapping = {
955 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
956 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
957 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
958 name = "FLAG_DIM_BEHIND"),
959 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
960 name = "FLAG_BLUR_BEHIND"),
961 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
962 name = "FLAG_NOT_FOCUSABLE"),
963 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
964 name = "FLAG_NOT_TOUCHABLE"),
965 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
966 name = "FLAG_NOT_TOUCH_MODAL"),
967 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
968 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
969 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
970 name = "FLAG_KEEP_SCREEN_ON"),
971 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
972 name = "FLAG_LAYOUT_IN_SCREEN"),
973 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
974 name = "FLAG_LAYOUT_NO_LIMITS"),
975 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
976 name = "FLAG_FULLSCREEN"),
977 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
978 name = "FLAG_FORCE_NOT_FULLSCREEN"),
979 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
980 name = "FLAG_DITHER"),
981 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
982 name = "FLAG_SECURE"),
983 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
984 name = "FLAG_SCALED"),
985 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
986 name = "FLAG_IGNORE_CHEEK_PRESSES"),
987 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
988 name = "FLAG_LAYOUT_INSET_DECOR"),
989 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
990 name = "FLAG_ALT_FOCUSABLE_IM"),
991 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
992 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
993 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
994 name = "FLAG_SHOW_WHEN_LOCKED"),
995 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
996 name = "FLAG_SHOW_WALLPAPER"),
997 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
998 name = "FLAG_TURN_SCREEN_ON"),
999 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
1000 name = "FLAG_DISMISS_KEYGUARD"),
1001 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
1002 name = "FLAG_SPLIT_TOUCH"),
1003 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
keunyoung30f420f2013-08-02 14:23:10 -07001004 name = "FLAG_HARDWARE_ACCELERATED"),
1005 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
John Spurlockbd957402013-10-03 11:38:39 -04001006 name = "FLAG_LOCAL_FOCUS_MODE"),
1007 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
1008 name = "FLAG_TRANSLUCENT_STATUS"),
1009 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Adrian Roos217ccd22014-05-09 14:29:04 +02001010 name = "FLAG_TRANSLUCENT_NAVIGATION"),
1011 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
1012 name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001013 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001014 public int flags;
1015
1016 /**
John Reck61375a82014-09-18 19:27:48 +00001017 * If the window has requested hardware acceleration, but this is not
1018 * allowed in the process it is in, then still render it as if it is
1019 * hardware accelerated. This is used for the starting preview windows
1020 * in the system process, which don't need to have the overhead of
1021 * hardware acceleration (they are just a static rendering), but should
1022 * be rendered as such to match the actual window of the app even if it
1023 * is hardware accelerated.
1024 * Even if the window isn't hardware accelerated, still do its rendering
1025 * as if it was.
1026 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1027 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
1028 * is generally disabled. This flag must be specified in addition to
1029 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1030 * windows.
1031 *
1032 * @hide
1033 */
1034 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1035
1036 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001037 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001038 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001039 * If certain parts of the UI that really do want to use hardware
1040 * acceleration, this flag can be set to force it. This is basically
1041 * for the lock screen. Anyone else using it, you are probably wrong.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001042 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001043 * @hide
1044 */
1045 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1046
1047 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001048 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001049 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001050 * them (they do not affect the wallpaper scrolling operation) by calling
1051 * {@link
1052 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1053 *
1054 * @hide
1055 */
1056 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1057
Craig Mautner88400d32012-09-30 12:35:45 -07001058 /** In a multiuser system if this flag is set and the owner is a system process then this
1059 * window will appear on all user screens. This overrides the default behavior of window
1060 * types that normally only appear on the owning user's screen. Refer to each window type
1061 * to determine its default behavior.
1062 *
1063 * {@hide} */
1064 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1065
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001066 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001067 * Never animate position changes of the window.
1068 *
1069 * {@hide} */
1070 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1071
Adam Lesinski6a591f52013-10-01 18:11:17 -07001072 /** Window flag: special flag to limit the size of the window to be
1073 * original size ([320x480] x density). Used to create window for applications
1074 * running under compatibility mode.
1075 *
1076 * {@hide} */
1077 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1078
1079 /** Window flag: a special option intended for system dialogs. When
1080 * this flag is set, the window will demand focus unconditionally when
1081 * it is created.
1082 * {@hide} */
1083 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1084
John Spurlock3f7cd512013-10-07 12:25:09 -04001085 /** Window flag: maintain the previous translucent decor state when this window
John Spurlockbd957402013-10-03 11:38:39 -04001086 * becomes top-most.
1087 * {@hide} */
1088 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
1089
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001090 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001091 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1092 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1093 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1094 * {@hide}
1095 */
1096 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1097
1098 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001099 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1100 *
1101 * {@hide}
1102 */
1103 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1104
1105 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001106 * Control flags that are private to the platform.
1107 * @hide
1108 */
1109 public int privateFlags;
1110
1111 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001112 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1113 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1114 * key. For this case, we should look at windows behind it to determine the appropriate
1115 * value.
1116 *
1117 * @hide
1118 */
1119 public static final int NEEDS_MENU_UNSET = 0;
1120
1121 /**
1122 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1123 * menu key.
1124 *
1125 * @hide
1126 */
1127 public static final int NEEDS_MENU_SET_TRUE = 1;
1128
1129 /**
1130 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1131 * needs a menu key.
1132 *
1133 * @hide
1134 */
1135 public static final int NEEDS_MENU_SET_FALSE = 2;
1136
1137 /**
1138 * State variable for a window belonging to an activity that responds to
1139 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1140 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1141 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1142 *
1143 * (Note that Action Bars, when available, are the preferred way to offer additional
1144 * functions otherwise accessed via an options menu.)
1145 *
1146 * {@hide}
1147 */
1148 public int needsMenuKey = NEEDS_MENU_UNSET;
1149
1150 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 * Given a particular set of window manager flags, determine whether
1152 * such a window may be a target for an input method when it has
1153 * focus. In particular, this checks the
1154 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1155 * flags and returns true if the combination of the two corresponds
1156 * to a window that needs to be behind the input method so that the
1157 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001158 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001160 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 * @return Returns true if such a window should be behind/interact
1162 * with an input method, false if not.
1163 */
1164 public static boolean mayUseInputMethod(int flags) {
1165 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
1166 case 0:
1167 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
1168 return true;
1169 }
1170 return false;
1171 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001172
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 /**
1174 * Mask for {@link #softInputMode} of the bits that determine the
1175 * desired visibility state of the soft input area for this window.
1176 */
1177 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001178
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001179 /**
1180 * Visibility state for {@link #softInputMode}: no state has been specified.
1181 */
1182 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001183
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 /**
1185 * Visibility state for {@link #softInputMode}: please don't change the state of
1186 * the soft input area.
1187 */
1188 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001189
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001190 /**
1191 * Visibility state for {@link #softInputMode}: please hide any soft input
1192 * area when normally appropriate (when the user is navigating
1193 * forward to your window).
1194 */
1195 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001196
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001197 /**
1198 * Visibility state for {@link #softInputMode}: please always hide any
1199 * soft input area when this window receives focus.
1200 */
1201 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001202
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 /**
1204 * Visibility state for {@link #softInputMode}: please show the soft
1205 * input area when normally appropriate (when the user is navigating
1206 * forward to your window).
1207 */
1208 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001209
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001210 /**
1211 * Visibility state for {@link #softInputMode}: please always make the
1212 * soft input area visible when this window receives input focus.
1213 */
1214 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001215
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 /**
1217 * Mask for {@link #softInputMode} of the bits that determine the
1218 * way that the window should be adjusted to accommodate the soft
1219 * input window.
1220 */
1221 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001222
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 /** Adjustment option for {@link #softInputMode}: nothing specified.
1224 * The system will try to pick one or
1225 * the other depending on the contents of the window.
1226 */
1227 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001228
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001229 /** Adjustment option for {@link #softInputMode}: set to allow the
1230 * window to be resized when an input
1231 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07001232 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001233 * {@link #SOFT_INPUT_ADJUST_PAN}; if
1234 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07001235 * the other depending on the contents of the window. If the window's
1236 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
1237 * value for {@link #softInputMode} will be ignored; the window will
1238 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001239 */
1240 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001241
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001242 /** Adjustment option for {@link #softInputMode}: set to have a window
1243 * pan when an input method is
1244 * shown, so it doesn't need to deal with resizing but just panned
1245 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07001246 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247 * neither of these are set, then the system will try to pick one or
1248 * the other depending on the contents of the window.
1249 */
1250 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001251
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001252 /** Adjustment option for {@link #softInputMode}: set to have a window
1253 * not adjust for a shown input method. The window will not be resized,
1254 * and it will not be panned to make its focus visible.
1255 */
1256 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
1257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001258 /**
1259 * Bit for {@link #softInputMode}: set when the user has navigated
1260 * forward to the window. This is normally set automatically for
1261 * you by the system, though you may want to set it in certain cases
1262 * when you are displaying a window yourself. This flag will always
1263 * be cleared automatically after the window is displayed.
1264 */
1265 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001266
1267 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08001268 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001269 * of:
Wonsik Kim475e3f02014-03-17 11:17:47 +00001270 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 * <ul>
1272 * <li> One of the visibility states
1273 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
1274 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or
1275 * {@link #SOFT_INPUT_STATE_VISIBLE}.
1276 * <li> One of the adjustment options
1277 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},
1278 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or
1279 * {@link #SOFT_INPUT_ADJUST_PAN}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001280 * </ul>
1281 *
1282 *
1283 * <p>This flag can be controlled in your theme through the
1284 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001285 */
1286 public int softInputMode;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001287
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001288 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001289 * Placement of window within the screen as per {@link Gravity}. Both
1290 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1291 * android.graphics.Rect) Gravity.apply} and
1292 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1293 * Gravity.applyDisplay} are used during window layout, with this value
1294 * given as the desired gravity. For example you can specify
1295 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
1296 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
1297 * to control the behavior of
1298 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1299 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001300 *
1301 * @see Gravity
1302 */
1303 public int gravity;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001304
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001305 /**
1306 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001307 * between the container and the widget. See
1308 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1309 * android.graphics.Rect) Gravity.apply} for how this is used. This
1310 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001311 */
1312 public float horizontalMargin;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001313
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001314 /**
1315 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001316 * between the container and the widget. See
1317 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1318 * android.graphics.Rect) Gravity.apply} for how this is used. This
1319 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001320 */
1321 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001322
1323 /**
1324 * Positive insets between the drawing surface and window content.
1325 *
1326 * @hide
1327 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07001328 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08001329
1330 /**
1331 * Whether the surface insets have been manually set. When set to
1332 * {@code false}, the view root will automatically determine the
1333 * appropriate surface insets.
1334 *
1335 * @see #surfaceInsets
1336 * @hide
1337 */
1338 public boolean hasManualSurfaceInsets;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001340 /**
1341 * The desired bitmap format. May be one of the constants in
1342 * {@link android.graphics.PixelFormat}. Default is OPAQUE.
1343 */
1344 public int format;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001345
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001346 /**
1347 * A style resource defining the animations to use for this window.
1348 * This must be a system resource; it can not be an application resource
1349 * because the window manager does not have access to applications.
1350 */
1351 public int windowAnimations;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001352
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001353 /**
1354 * An alpha value to apply to this entire window.
1355 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1356 */
1357 public float alpha = 1.0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001358
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001359 /**
1360 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1361 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1362 * dim.
1363 */
1364 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001365
1366 /**
1367 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1368 * indicating that the brightness value is not overridden for this window
1369 * and normal brightness policy should be used.
1370 */
1371 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1372
1373 /**
1374 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1375 * indicating that the screen or button backlight brightness should be set
1376 * to the lowest value when this window is in front.
1377 */
1378 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1379
1380 /**
1381 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1382 * indicating that the screen or button backlight brightness should be set
1383 * to the hightest value when this window is in front.
1384 */
1385 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001386
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001387 /**
1388 * This can be used to override the user's preferred brightness of
1389 * the screen. A value of less than 0, the default, means to use the
1390 * preferred screen brightness. 0 to 1 adjusts the brightness from
1391 * dark to full bright.
1392 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001393 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001394
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001395 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001396 * This can be used to override the standard behavior of the button and
1397 * keyboard backlights. A value of less than 0, the default, means to
1398 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1399 * from dark to full bright.
1400 */
1401 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1402
1403 /**
Craig Mautner3c174372013-02-21 17:54:37 -08001404 * Value for {@link #rotationAnimation} to define the animation used to
1405 * specify that this window will rotate in or out following a rotation.
1406 */
1407 public static final int ROTATION_ANIMATION_ROTATE = 0;
1408
1409 /**
1410 * Value for {@link #rotationAnimation} to define the animation used to
1411 * specify that this window will fade in or out following a rotation.
1412 */
1413 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
1414
1415 /**
1416 * Value for {@link #rotationAnimation} to define the animation used to
1417 * specify that this window will immediately disappear or appear following
1418 * a rotation.
1419 */
1420 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
1421
1422 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001423 * Define the exit and entry animations used on this window when the device is rotated.
1424 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08001425 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001426 * by other windows. All other situations default to the
1427 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001428 *
Craig Mautner3c174372013-02-21 17:54:37 -08001429 * @see #ROTATION_ANIMATION_ROTATE
1430 * @see #ROTATION_ANIMATION_CROSSFADE
1431 * @see #ROTATION_ANIMATION_JUMPCUT
1432 */
1433 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
1434
1435 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001436 * Identifier for this window. This will usually be filled in for
1437 * you.
1438 */
1439 public IBinder token = null;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001440
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001441 /**
1442 * Name of the package owning this window.
1443 */
1444 public String packageName = null;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001445
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001446 /**
1447 * Specific orientation value for a window.
1448 * May be any of the same values allowed
Wonsik Kim475e3f02014-03-17 11:17:47 +00001449 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1450 * If not set, a default value of
1451 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001452 * will be used.
1453 */
1454 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001455
1456 /**
Michael Wright3f145a22014-07-22 19:46:03 -07001457 * The preferred refresh rate for the window.
1458 *
1459 * This must be one of the supported refresh rates obtained for the display(s) the window
1460 * is on.
1461 *
1462 * @see Display#getSupportedRefreshRates()
1463 */
1464 public float preferredRefreshRate;
1465
1466 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001467 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001468 *
1469 * @see View#STATUS_BAR_VISIBLE
1470 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001471 */
1472 public int systemUiVisibility;
1473
1474 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001475 * @hide
1476 * The ui visibility as requested by the views in this hierarchy.
1477 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1478 */
1479 public int subtreeSystemUiVisibility;
1480
1481 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001482 * Get callbacks about the system ui visibility changing.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001483 *
Joe Onorato664644d2011-01-23 17:53:23 -08001484 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1485 *
1486 * @hide
1487 */
1488 public boolean hasSystemUiListeners;
1489
Jeff Brown474dcb52011-06-14 20:22:50 -07001490 /**
1491 * When this window has focus, disable touch pad pointer gesture processing.
1492 * The window will receive raw position updates from the touch pad instead
1493 * of pointer movements and synthetic touch events.
1494 *
1495 * @hide
1496 */
1497 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1498
1499 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001500 * Does not construct an input channel for this window. The channel will therefore
1501 * be incapable of receiving input.
1502 *
1503 * @hide
1504 */
1505 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1506
1507 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001508 * When this window has focus, does not call user activity for all input events so
1509 * the application will have to do it itself. Should only be used by
1510 * the keyguard and phone app.
1511 * <p>
1512 * Should only be used by the keyguard and phone app.
1513 * </p>
1514 *
1515 * @hide
1516 */
1517 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
1518
1519 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001520 * Control special features of the input subsystem.
1521 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001522 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001523 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001524 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07001525 * @hide
1526 */
1527 public int inputFeatures;
1528
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001529 /**
1530 * Sets the number of milliseconds before the user activity timeout occurs
1531 * when this window has focus. A value of -1 uses the standard timeout.
1532 * A value of 0 uses the minimum support display timeout.
1533 * <p>
1534 * This property can only be used to reduce the user specified display timeout;
1535 * it can never make the timeout longer than it normally would be.
1536 * </p><p>
1537 * Should only be used by the keyguard and phone app.
1538 * </p>
1539 *
1540 * @hide
1541 */
1542 public long userActivityTimeout = -1;
1543
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001544 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001545 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001546 type = TYPE_APPLICATION;
1547 format = PixelFormat.OPAQUE;
1548 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001549
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001550 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001551 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001552 type = _type;
1553 format = PixelFormat.OPAQUE;
1554 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001555
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001556 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001557 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001558 type = _type;
1559 flags = _flags;
1560 format = PixelFormat.OPAQUE;
1561 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001562
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001563 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08001564 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001565 type = _type;
1566 flags = _flags;
1567 format = _format;
1568 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001569
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001570 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
1571 super(w, h);
1572 type = _type;
1573 flags = _flags;
1574 format = _format;
1575 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001576
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001577 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
1578 int _flags, int _format) {
1579 super(w, h);
1580 x = xpos;
1581 y = ypos;
1582 type = _type;
1583 flags = _flags;
1584 format = _format;
1585 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001586
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001587 public final void setTitle(CharSequence title) {
1588 if (null == title)
1589 title = "";
Wonsik Kim475e3f02014-03-17 11:17:47 +00001590
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001591 mTitle = TextUtils.stringOrSpannedString(title);
1592 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001593
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001594 public final CharSequence getTitle() {
1595 return mTitle;
1596 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08001597
1598 /** @hide */
1599 @SystemApi
1600 public final void setUserActivityTimeout(long timeout) {
1601 userActivityTimeout = timeout;
1602 }
1603
1604 /** @hide */
1605 @SystemApi
1606 public final long getUserActivityTimeout() {
1607 return userActivityTimeout;
1608 }
1609
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001610 public int describeContents() {
1611 return 0;
1612 }
1613
1614 public void writeToParcel(Parcel out, int parcelableFlags) {
1615 out.writeInt(width);
1616 out.writeInt(height);
1617 out.writeInt(x);
1618 out.writeInt(y);
1619 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001620 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001621 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001622 out.writeInt(softInputMode);
1623 out.writeInt(gravity);
1624 out.writeFloat(horizontalMargin);
1625 out.writeFloat(verticalMargin);
1626 out.writeInt(format);
1627 out.writeInt(windowAnimations);
1628 out.writeFloat(alpha);
1629 out.writeFloat(dimAmount);
1630 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001631 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08001632 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001633 out.writeStrongBinder(token);
1634 out.writeString(packageName);
1635 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
1636 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07001637 out.writeFloat(preferredRefreshRate);
Joe Onorato664644d2011-01-23 17:53:23 -08001638 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08001639 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08001640 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07001641 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001642 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07001643 out.writeInt(surfaceInsets.left);
1644 out.writeInt(surfaceInsets.top);
1645 out.writeInt(surfaceInsets.right);
1646 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08001647 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001648 out.writeInt(needsMenuKey);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001649 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001650
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001651 public static final Parcelable.Creator<LayoutParams> CREATOR
1652 = new Parcelable.Creator<LayoutParams>() {
1653 public LayoutParams createFromParcel(Parcel in) {
1654 return new LayoutParams(in);
1655 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001656
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001657 public LayoutParams[] newArray(int size) {
1658 return new LayoutParams[size];
1659 }
1660 };
Wonsik Kim475e3f02014-03-17 11:17:47 +00001661
1662
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001663 public LayoutParams(Parcel in) {
1664 width = in.readInt();
1665 height = in.readInt();
1666 x = in.readInt();
1667 y = in.readInt();
1668 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001669 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001670 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001671 softInputMode = in.readInt();
1672 gravity = in.readInt();
1673 horizontalMargin = in.readFloat();
1674 verticalMargin = in.readFloat();
1675 format = in.readInt();
1676 windowAnimations = in.readInt();
1677 alpha = in.readFloat();
1678 dimAmount = in.readFloat();
1679 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001680 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08001681 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001682 token = in.readStrongBinder();
1683 packageName = in.readString();
1684 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
1685 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07001686 preferredRefreshRate = in.readFloat();
Joe Onorato664644d2011-01-23 17:53:23 -08001687 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08001688 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001689 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07001690 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001691 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07001692 surfaceInsets.left = in.readInt();
1693 surfaceInsets.top = in.readInt();
1694 surfaceInsets.right = in.readInt();
1695 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08001696 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001697 needsMenuKey = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001698 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001699
Romain Guy72998072009-06-22 11:09:20 -07001700 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001701 public static final int LAYOUT_CHANGED = 1<<0;
1702 public static final int TYPE_CHANGED = 1<<1;
1703 public static final int FLAGS_CHANGED = 1<<2;
1704 public static final int FORMAT_CHANGED = 1<<3;
1705 public static final int ANIMATION_CHANGED = 1<<4;
1706 public static final int DIM_AMOUNT_CHANGED = 1<<5;
1707 public static final int TITLE_CHANGED = 1<<6;
1708 public static final int ALPHA_CHANGED = 1<<7;
1709 public static final int MEMORY_TYPE_CHANGED = 1<<8;
1710 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
1711 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
1712 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08001713 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001714 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001715 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08001716 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001717 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08001718 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001719 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07001720 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001721 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001722 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001723 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07001724 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001725 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001726 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04001727 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
1728 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07001729 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001730 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07001731 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
1732 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001733 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
1734 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07001735 public static final int EVERYTHING_CHANGED = 0xffffffff;
1736
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001737 // internal buffer to backup/restore parameters under compatibility mode.
1738 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001739
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001740 public final int copyFrom(LayoutParams o) {
1741 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001742
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001743 if (width != o.width) {
1744 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07001745 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001746 }
1747 if (height != o.height) {
1748 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07001749 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001750 }
1751 if (x != o.x) {
1752 x = o.x;
1753 changes |= LAYOUT_CHANGED;
1754 }
1755 if (y != o.y) {
1756 y = o.y;
1757 changes |= LAYOUT_CHANGED;
1758 }
1759 if (horizontalWeight != o.horizontalWeight) {
1760 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001761 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001762 }
1763 if (verticalWeight != o.verticalWeight) {
1764 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001765 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001766 }
1767 if (horizontalMargin != o.horizontalMargin) {
1768 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001769 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001770 }
1771 if (verticalMargin != o.verticalMargin) {
1772 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001773 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001774 }
1775 if (type != o.type) {
1776 type = o.type;
1777 changes |= TYPE_CHANGED;
1778 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001779 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04001780 final int diff = flags ^ o.flags;
1781 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
1782 changes |= TRANSLUCENT_FLAGS_CHANGED;
1783 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001784 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07001785 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001786 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001787 if (privateFlags != o.privateFlags) {
1788 privateFlags = o.privateFlags;
1789 changes |= PRIVATE_FLAGS_CHANGED;
1790 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001791 if (softInputMode != o.softInputMode) {
1792 softInputMode = o.softInputMode;
1793 changes |= SOFT_INPUT_MODE_CHANGED;
1794 }
1795 if (gravity != o.gravity) {
1796 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07001797 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001798 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001799 if (format != o.format) {
1800 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07001801 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001802 }
1803 if (windowAnimations != o.windowAnimations) {
1804 windowAnimations = o.windowAnimations;
1805 changes |= ANIMATION_CHANGED;
1806 }
1807 if (token == null) {
1808 // NOTE: token only copied if the recipient doesn't
1809 // already have one.
1810 token = o.token;
1811 }
1812 if (packageName == null) {
1813 // NOTE: packageName only copied if the recipient doesn't
1814 // already have one.
1815 packageName = o.packageName;
1816 }
1817 if (!mTitle.equals(o.mTitle)) {
1818 mTitle = o.mTitle;
1819 changes |= TITLE_CHANGED;
1820 }
1821 if (alpha != o.alpha) {
1822 alpha = o.alpha;
1823 changes |= ALPHA_CHANGED;
1824 }
1825 if (dimAmount != o.dimAmount) {
1826 dimAmount = o.dimAmount;
1827 changes |= DIM_AMOUNT_CHANGED;
1828 }
1829 if (screenBrightness != o.screenBrightness) {
1830 screenBrightness = o.screenBrightness;
1831 changes |= SCREEN_BRIGHTNESS_CHANGED;
1832 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001833 if (buttonBrightness != o.buttonBrightness) {
1834 buttonBrightness = o.buttonBrightness;
1835 changes |= BUTTON_BRIGHTNESS_CHANGED;
1836 }
Craig Mautner3c174372013-02-21 17:54:37 -08001837 if (rotationAnimation != o.rotationAnimation) {
1838 rotationAnimation = o.rotationAnimation;
1839 changes |= ROTATION_ANIMATION_CHANGED;
1840 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001841
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001842 if (screenOrientation != o.screenOrientation) {
1843 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07001844 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001845 }
Romain Guy529b60a2010-08-03 18:05:47 -07001846
Michael Wright3f145a22014-07-22 19:46:03 -07001847 if (preferredRefreshRate != o.preferredRefreshRate) {
1848 preferredRefreshRate = o.preferredRefreshRate;
1849 changes |= PREFERRED_REFRESH_RATE_CHANGED;
1850 }
1851
Joe Onorato14782f72011-01-25 19:53:17 -08001852 if (systemUiVisibility != o.systemUiVisibility
1853 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08001854 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08001855 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08001856 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
1857 }
1858
1859 if (hasSystemUiListeners != o.hasSystemUiListeners) {
1860 hasSystemUiListeners = o.hasSystemUiListeners;
1861 changes |= SYSTEM_UI_LISTENER_CHANGED;
1862 }
1863
Jeff Brown474dcb52011-06-14 20:22:50 -07001864 if (inputFeatures != o.inputFeatures) {
1865 inputFeatures = o.inputFeatures;
1866 changes |= INPUT_FEATURES_CHANGED;
1867 }
1868
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001869 if (userActivityTimeout != o.userActivityTimeout) {
1870 userActivityTimeout = o.userActivityTimeout;
1871 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
1872 }
1873
Alan Viverette49a22e82014-07-12 20:01:27 -07001874 if (!surfaceInsets.equals(o.surfaceInsets)) {
1875 surfaceInsets.set(o.surfaceInsets);
1876 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001877 }
1878
Alan Viverette5435a302015-01-29 10:25:34 -08001879 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
1880 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
1881 changes |= SURFACE_INSETS_CHANGED;
1882 }
1883
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001884 if (needsMenuKey != o.needsMenuKey) {
1885 needsMenuKey = o.needsMenuKey;
1886 changes |= NEEDS_MENU_KEY_CHANGED;
1887 }
1888
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001889 return changes;
1890 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001891
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001892 @Override
1893 public String debug(String output) {
1894 output += "Contents of " + this + ":";
1895 Log.d("Debug", output);
1896 output = super.debug("");
1897 Log.d("Debug", output);
1898 Log.d("Debug", "");
1899 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
1900 return "";
1901 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001902
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001903 @Override
1904 public String toString() {
1905 StringBuilder sb = new StringBuilder(256);
1906 sb.append("WM.LayoutParams{");
1907 sb.append("(");
1908 sb.append(x);
1909 sb.append(',');
1910 sb.append(y);
1911 sb.append(")(");
Romain Guy980a9382010-01-08 15:06:28 -08001912 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001913 sb.append('x');
Romain Guy980a9382010-01-08 15:06:28 -08001914 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001915 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001916 if (horizontalMargin != 0) {
1917 sb.append(" hm=");
1918 sb.append(horizontalMargin);
1919 }
1920 if (verticalMargin != 0) {
1921 sb.append(" vm=");
1922 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001923 }
1924 if (gravity != 0) {
1925 sb.append(" gr=#");
1926 sb.append(Integer.toHexString(gravity));
1927 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001928 if (softInputMode != 0) {
1929 sb.append(" sim=#");
1930 sb.append(Integer.toHexString(softInputMode));
1931 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001932 sb.append(" ty=");
1933 sb.append(type);
1934 sb.append(" fl=#");
1935 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001936 if (privateFlags != 0) {
Adam Lesinski95c42972013-10-02 10:13:27 -07001937 if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
1938 sb.append(" compatible=true");
1939 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001940 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
1941 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001942 if (format != PixelFormat.OPAQUE) {
1943 sb.append(" fmt=");
1944 sb.append(format);
1945 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001946 if (windowAnimations != 0) {
1947 sb.append(" wanim=0x");
1948 sb.append(Integer.toHexString(windowAnimations));
1949 }
1950 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
1951 sb.append(" or=");
1952 sb.append(screenOrientation);
1953 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001954 if (alpha != 1.0f) {
1955 sb.append(" alpha=");
1956 sb.append(alpha);
1957 }
1958 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1959 sb.append(" sbrt=");
1960 sb.append(screenBrightness);
1961 }
1962 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1963 sb.append(" bbrt=");
1964 sb.append(buttonBrightness);
1965 }
Craig Mautner3c174372013-02-21 17:54:37 -08001966 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
1967 sb.append(" rotAnim=");
1968 sb.append(rotationAnimation);
1969 }
Michael Wright3f145a22014-07-22 19:46:03 -07001970 if (preferredRefreshRate != 0) {
1971 sb.append(" preferredRefreshRate=");
1972 sb.append(preferredRefreshRate);
1973 }
Joe Onorato664644d2011-01-23 17:53:23 -08001974 if (systemUiVisibility != 0) {
1975 sb.append(" sysui=0x");
1976 sb.append(Integer.toHexString(systemUiVisibility));
1977 }
Joe Onorato14782f72011-01-25 19:53:17 -08001978 if (subtreeSystemUiVisibility != 0) {
1979 sb.append(" vsysui=0x");
1980 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
1981 }
Joe Onorato664644d2011-01-23 17:53:23 -08001982 if (hasSystemUiListeners) {
1983 sb.append(" sysuil=");
1984 sb.append(hasSystemUiListeners);
1985 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001986 if (inputFeatures != 0) {
1987 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
1988 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001989 if (userActivityTimeout >= 0) {
1990 sb.append(" userActivityTimeout=").append(userActivityTimeout);
1991 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07001992 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Andreas Gampe11090062015-03-16 09:45:34 -07001993 surfaceInsets.bottom != 0 || hasManualSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07001994 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08001995 if (hasManualSurfaceInsets) {
1996 sb.append(" (manual)");
1997 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07001998 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001999 if (needsMenuKey != NEEDS_MENU_UNSET) {
2000 sb.append(" needsMenuKey=");
2001 sb.append(needsMenuKey);
2002 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002003 sb.append('}');
2004 return sb.toString();
2005 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002006
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002007 /**
2008 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002009 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002010 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002011 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002012 x = (int) (x * scale + 0.5f);
2013 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002014 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002015 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002016 }
2017 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002018 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002019 }
2020 }
2021
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002022 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002023 * Backup the layout parameters used in compatibility mode.
2024 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002025 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002026 void backup() {
2027 int[] backup = mCompatibilityParamsBackup;
2028 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002029 // we backup 4 elements, x, y, width, height
2030 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002031 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002032 backup[0] = x;
2033 backup[1] = y;
2034 backup[2] = width;
2035 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002036 }
2037
2038 /**
2039 * Restore the layout params' coordinates, size and gravity
2040 * @see LayoutParams#backup()
2041 */
2042 void restore() {
2043 int[] backup = mCompatibilityParamsBackup;
2044 if (backup != null) {
2045 x = backup[0];
2046 y = backup[1];
2047 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002048 height = backup[3];
2049 }
2050 }
2051
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002052 private CharSequence mTitle = "";
2053 }
2054}