blob: 2797b6e9a0abe266f81996ec5cbe96b0fb0732a7 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.view;
18
Siva Velusamy0d857b92015-04-22 10:23:56 -070019import android.annotation.NonNull;
Bryce Lee53b9fbd2015-02-06 12:06:34 -080020import android.annotation.SystemApi;
Jeff Browna492c3a2012-08-23 19:48:44 -070021import android.app.Presentation;
22import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.pm.ActivityInfo;
24import android.graphics.PixelFormat;
Alan Viveretteccb11e12014-07-08 16:04:02 -070025import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.os.IBinder;
27import android.os.Parcel;
28import android.os.Parcelable;
29import android.text.TextUtils;
30import android.util.Log;
31
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>
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700167 *
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
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700174 * @see #TYPE_APPLICATION_ABOVE_SUB_PANEL
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800175 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
176 * @see #TYPE_STATUS_BAR
177 * @see #TYPE_SEARCH_BAR
178 * @see #TYPE_PHONE
179 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800180 * @see #TYPE_TOAST
181 * @see #TYPE_SYSTEM_OVERLAY
182 * @see #TYPE_PRIORITY_PHONE
183 * @see #TYPE_STATUS_BAR_PANEL
184 * @see #TYPE_SYSTEM_DIALOG
185 * @see #TYPE_KEYGUARD_DIALOG
186 * @see #TYPE_SYSTEM_ERROR
187 * @see #TYPE_INPUT_METHOD
188 * @see #TYPE_INPUT_METHOD_DIALOG
189 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700190 @ViewDebug.ExportedProperty(mapping = {
191 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
192 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
193 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
194 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
195 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
196 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700197 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL, to = "TYPE_APPLICATION_ABOVE_SUB_PANEL"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700198 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700199 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700200 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
201 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
202 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
203 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700204 @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
205 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
206 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700207 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"),
208 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
209 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
210 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
Jeff Brown3b2b3542010-10-15 00:54:27 -0700211 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700212 @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
213 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700214 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700215 @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
216 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
217 @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
218 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
219 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700220 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
221 @ViewDebug.IntToString(from = TYPE_HIDDEN_NAV_CONSUMER, to = "TYPE_HIDDEN_NAV_CONSUMER"),
222 @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
Jeff Brownbd6e1502012-08-28 03:27:37 -0700223 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"),
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700224 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"),
keunyounga446bf02013-06-21 19:07:57 -0700225 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY"),
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700226 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION"),
227 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, to = "TYPE_VOICE_INTERACTION"),
Jorim Jaggi225d3b52015-04-01 11:18:57 -0700228 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, to = "TYPE_VOICE_INTERACTION_STARTING"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700229 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800230 public int type;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000231
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800232 /**
233 * Start of window types that represent normal application windows.
234 */
235 public static final int FIRST_APPLICATION_WINDOW = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000236
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800237 /**
238 * Window type: an application window that serves as the "base" window
239 * of the overall application; all other application windows will
240 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700241 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800242 */
243 public static final int TYPE_BASE_APPLICATION = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 /**
246 * Window type: a normal application window. The {@link #token} must be
247 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700248 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800249 */
250 public static final int TYPE_APPLICATION = 2;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000251
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800252 /**
253 * Window type: special application window that is displayed while the
254 * application is starting. Not for use by applications themselves;
255 * this is used by the system to display something until the
256 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700257 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800258 */
259 public static final int TYPE_APPLICATION_STARTING = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000260
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800261 /**
262 * End of types of application windows.
263 */
264 public static final int LAST_APPLICATION_WINDOW = 99;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700265
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800266 /**
267 * Start of types of sub-windows. The {@link #token} of these windows
268 * must be set to the window they are attached to. These types of
269 * windows are kept next to their attached window in Z-order, and their
270 * coordinate space is relative to their attached window.
271 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700272 public static final int FIRST_SUB_WINDOW = 1000;
273
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800274 /**
275 * Window type: a panel on top of an application window. These windows
276 * appear on top of their attached window.
277 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700278 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
279
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800280 /**
John Spurlock33291d82013-03-13 14:45:14 -0400281 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800282 * are displayed behind their attached window.
283 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700284 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1;
285
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800286 /**
287 * Window type: a sub-panel on top of an application window. These
288 * windows are displayed on top their attached window and any
289 * {@link #TYPE_APPLICATION_PANEL} panels.
290 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700291 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292
293 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
294 * of the window happens as that of a top-level window, <em>not</em>
295 * as a child of its container.
296 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700297 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3;
298
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800299 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700300 * Window type: window for showing overlays on top of media windows.
301 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
302 * application window. They should be translucent to be useful. This
303 * is a big ugly hack so:
304 * @hide
305 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700306 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4;
307
308 /**
309 * Window type: a above sub-panel on top of an application window and it's
310 * sub-panel windows. These windows are displayed on top of their attached window
311 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels.
312 */
313 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5;
314
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700315 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 * End of types of sub-windows.
317 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700318 public static final int LAST_SUB_WINDOW = 1999;
319
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800320 /**
321 * Start of system-specific window types. These are not normally
322 * created by applications.
323 */
324 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700325
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 /**
327 * Window type: the status bar. There can be only one status bar
328 * window; it is placed at the top of the screen, and all other
329 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700330 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800331 */
332 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000333
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800334 /**
335 * Window type: the search bar. There can be only one search bar
336 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700337 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800338 */
339 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000340
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800341 /**
342 * Window type: phone. These are non-application windows providing
343 * user interaction with the phone (in particular incoming calls).
344 * These windows are normally placed above all applications, but behind
345 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700346 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347 */
348 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000349
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 /**
351 * Window type: system window, such as low power alert. These windows
352 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700353 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 */
355 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100356
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800357 /**
358 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700359 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200360 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800361 */
362 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100363
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800364 /**
365 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700366 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800367 */
368 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000369
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 /**
371 * Window type: system overlay windows, which need to be displayed
372 * on top of everything else. These windows must not take input
373 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700374 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800375 */
376 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000377
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800378 /**
379 * Window type: priority phone UI, which needs to be displayed even if
380 * the keyguard is active. These windows must not take input
381 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700382 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800383 */
384 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 /**
387 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700388 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000391
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 /**
393 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700394 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800395 */
396 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000397
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800398 /**
399 * Window type: internal system error windows, appear on top of
400 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700401 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800402 */
403 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000404
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800405 /**
406 * Window type: internal input methods windows, which appear above
407 * the normal UI. Application windows may be resized or panned to keep
408 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700409 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800410 */
411 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
412
413 /**
414 * Window type: internal input methods dialog windows, which appear above
415 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700416 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800417 */
418 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
419
420 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700421 * Window type: wallpaper window, placed behind any window that wants
422 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700423 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700424 */
425 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
426
427 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800428 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700429 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800430 */
431 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700432
433 /**
434 * Window type: secure system overlay windows, which need to be displayed
435 * on top of everything else. These windows must not take input
436 * focus, or they will interfere with the keyguard.
437 *
438 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
439 * system itself is allowed to create these overlays. Applications cannot
440 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700441 *
442 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700443 * @hide
444 */
445 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
446
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800447 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700448 * Window type: the drag-and-drop pseudowindow. There is only one
449 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700450 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700451 * @hide
452 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700453 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700454
455 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800456 * Window type: panel that slides out from under the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700457 * In multiuser systems shows on all users' windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800458 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800459 */
460 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
461
Jeff Brown83c09682010-12-23 17:50:18 -0800462 /**
463 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700464 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800465 * @hide
466 */
467 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800468
469 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400470 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700471 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400472 * @hide
473 */
474 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
475
476 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700477 * Window type: The volume level overlay/dialog shown when the user
478 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700479 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700480 * @hide
481 */
482 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
483
484 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700485 * Window type: The boot progress dialog, goes on top of everything
486 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700487 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700488 * @hide
489 */
490 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
491
492 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700493 * Window type: Fake window to consume touch events when the navigation
494 * bar is hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700495 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700496 * @hide
497 */
498 public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22;
499
500 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500501 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700502 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500503 * @hide
504 */
505 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
506
507 /**
Jim Millere898ac52012-04-06 17:10:57 -0700508 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700509 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700510 * @hide
511 */
512 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
513
514 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700515 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700516 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700517 * @hide
518 */
519 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
520
521 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700522 * Window type: Magnification overlay window. Used to highlight the magnified
523 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -0700524 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700525 * @hide
526 */
527 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
528
529 /**
Jim Miller5ecd8112013-01-09 18:50:26 -0800530 * Window type: keyguard scrim window. Shows if keyguard needs to be restarted.
531 * In multiuser systems shows on all users' windows.
532 * @hide
533 */
534 public static final int TYPE_KEYGUARD_SCRIM = FIRST_SYSTEM_WINDOW+29;
535
Craig Mautner88400d32012-09-30 12:35:45 -0700536 /**
keunyounga446bf02013-06-21 19:07:57 -0700537 * Window type: Window for Presentation on top of private
538 * virtual display.
539 */
540 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
541
542 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700543 * Window type: Windows in the voice interaction layer.
544 * @hide
545 */
546 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
547
548 /**
Svetoslav3a5c7212014-10-14 09:54:26 -0700549 * Window type: Windows that are overlaid <em>only</em> by an {@link
550 * android.accessibilityservice.AccessibilityService} for interception of
551 * user interactions without changing the windows an accessibility service
552 * can introspect. In particular, an accessibility service can introspect
553 * only windows that a sighted user can interact with which is they can touch
554 * these windows or can type into these windows. For example, if there
555 * is a full screen accessibility overlay that is touchable, the windows
556 * below it will be introspectable by an accessibility service regardless
557 * they are covered by a touchable window.
558 */
559 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
560
561 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -0700562 * Window type: Starting window for voice interaction layer.
563 * @hide
564 */
565 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
566
567 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800568 * End of types of system windows.
569 */
570 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800571
Mathias Agopiand2112302010-12-07 19:38:17 -0800572 /** @deprecated this is ignored, this value is set automatically when needed. */
573 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800574 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800575 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700576 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800577 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800578 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700579 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800580 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800581 /** @deprecated this is ignored, this value is set automatically when needed. */
582 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800583 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000584
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800585 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700586 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800587 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700588 @Deprecated
589 public int memoryType;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000590
Mike Lockwoodef731622010-01-27 17:51:34 -0500591 /** Window flag: as long as this window is visible to the user, allow
Wonsik Kim475e3f02014-03-17 11:17:47 +0000592 * the lock screen to activate while the screen is on.
593 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800594 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500595 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
596
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800597 /** Window flag: everything behind this window will be dimmed.
598 * Use {@link #dimAmount} to control the amount of dim. */
599 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700600
601 /** Window flag: blur everything behind this window.
602 * @deprecated Blurring is no longer supported. */
603 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800604 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700605
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800606 /** Window flag: this window won't ever get key input focus, so the
607 * user can not send key or other button events to it. Those will
608 * instead go to whatever focusable window is behind it. This flag
609 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
610 * is explicitly set.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000611 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800612 * <p>Setting this flag also implies that the window will not need to
613 * interact with
Wonsik Kim475e3f02014-03-17 11:17:47 +0000614 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800615 * independently of any active input method (typically this means it
616 * gets Z-ordered on top of the input method, so it can use the full
617 * screen for its content and cover the input method if needed. You
618 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
619 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000620
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 /** Window flag: this window can never receive touch events. */
622 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000623
John Spurlock33291d82013-03-13 14:45:14 -0400624 /** Window flag: even when this window is focusable (its
625 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800626 * outside of the window to be sent to the windows behind it. Otherwise
627 * it will consume all pointer events itself, regardless of whether they
628 * are inside of the window. */
629 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000630
John Spurlock33291d82013-03-13 14:45:14 -0400631 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800632 * screen is pressed, you will receive this first touch event. Usually
633 * the first touch event is consumed by the system since the user can
634 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -0700635 *
636 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800637 */
Jeff Brown037c33e2014-04-09 00:31:55 -0700638 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000640
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800641 /** Window flag: as long as this window is visible to the user, keep
642 * the device's screen turned on and bright. */
643 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000644
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800645 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -0400646 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800647 * window must correctly position its contents to take the screen
648 * decoration into account. This flag is normally set for you
649 * by Window as described in {@link Window#setFlags}. */
650 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000651
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800652 /** Window flag: allow window to extend outside of the screen. */
653 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000654
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800655 /**
John Spurlock33291d82013-03-13 14:45:14 -0400656 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800657 * this window is displayed. This allows the window to use the entire
658 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -0700659 * an app window with this flag set is on the top layer. A fullscreen window
660 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
661 * {@link #softInputMode} field; the window will stay fullscreen
662 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800663 *
664 * <p>This flag can be controlled in your theme through the
665 * {@link android.R.attr#windowFullscreen} attribute; this attribute
666 * is automatically set for you in the standard fullscreen themes
667 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
668 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
669 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
670 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
671 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
672 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
673 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
674 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 public static final int FLAG_FULLSCREEN = 0x00000400;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000676
John Spurlock33291d82013-03-13 14:45:14 -0400677 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
678 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800679 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000680
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700682 * the screen.
683 * @deprecated This flag is no longer used. */
684 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800685 public static final int FLAG_DITHER = 0x00001000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000686
John Spurlock33291d82013-03-13 14:45:14 -0400687 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -0700688 * it from appearing in screenshots or from being viewed on non-secure
689 * displays.
690 *
691 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
692 * secure surfaces and secure displays.
693 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 public static final int FLAG_SECURE = 0x00002000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000695
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800696 /** Window flag: a special mode where the layout parameters are used
697 * to perform scaling of the surface when it is composited to the
698 * screen. */
699 public static final int FLAG_SCALED = 0x00004000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000700
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 /** Window flag: intended for windows that will often be used when the user is
702 * holding the screen against their face, it will aggressively filter the event
703 * stream to prevent unintended presses in this situation that may not be
Wonsik Kim475e3f02014-03-17 11:17:47 +0000704 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 * application will receive a CANCEL motion event to indicate this so applications
Wonsik Kim475e3f02014-03-17 11:17:47 +0000706 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800707 * until the finger is released. */
708 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 /** Window flag: a special option only for use in combination with
711 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
712 * screen your window may appear on top of or behind screen decorations
713 * such as the status bar. By also including this flag, the window
714 * manager will report the inset rectangle needed to ensure your
715 * content is not covered by screen decorations. This flag is normally
716 * set for you by Window as described in {@link Window#setFlags}.*/
717 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000718
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800719 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
720 * respect to how this window interacts with the current method. That
721 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
722 * window will behave as if it needs to interact with the input method
723 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
724 * not set and this flag is set, then the window will behave as if it
725 * doesn't need to interact with the input method and can be placed
726 * to use more space and cover the input method.
727 */
728 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000729
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800730 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
731 * can set this flag to receive a single special MotionEvent with
732 * the action
733 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
734 * touches that occur outside of your window. Note that you will not
735 * receive the full down/move/up gesture, only the location of the
736 * first down as an ACTION_OUTSIDE.
737 */
738 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000739
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700740 /** Window flag: special flag to let windows be shown when the screen
741 * is locked. This will let application windows take precedence over
742 * key guard or any other lock screens. Can be used with
743 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700744 * directly before showing the key guard window. Can be used with
745 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
746 * non-secure keyguards. This flag only applies to the top-most
747 * full-screen window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700748 */
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700749 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
750
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700751 /** Window flag: ask that the system wallpaper be shown behind
752 * your window. The window surface must be translucent to be able
753 * to actually see the wallpaper behind it; this flag just ensures
754 * that the wallpaper surface will be there if this window actually
755 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800756 *
757 * <p>This flag can be controlled in your theme through the
758 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
759 * is automatically set for you in the standard wallpaper themes
760 * such as {@link android.R.style#Theme_Wallpaper},
761 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
762 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
763 * {@link android.R.style#Theme_Holo_Wallpaper},
764 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
765 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
766 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700767 */
768 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000769
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700770 /** Window flag: when set as a window is being added or made
771 * visible, once the window has been shown then the system will
772 * poke the power manager's user activity (as if the user had woken
773 * up the device) to turn the screen on. */
774 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000775
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700776 /** Window flag: when set the window will cause the keyguard to
777 * be dismissed, only if it is not a secure lock keyguard. Because such
778 * a keyguard is not needed for security, it will never re-appear if
779 * the user navigates to another window (in contrast to
780 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
781 * hide both secure and non-secure keyguards but ensure they reappear
782 * when the user moves to another UI that doesn't hide them).
783 * If the keyguard is currently active and is secure (requires an
784 * unlock pattern) than the user will still need to confirm it before
785 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
Daniel Sandlerae069f72010-06-17 21:56:26 -0400786 * also been set.
787 */
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700788 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000789
Jeff Brown01ce2e92010-09-26 22:20:12 -0700790 /** Window flag: when set the window will accept for touch events
791 * outside of its bounds to be sent to other windows that also
792 * support split touch. When this flag is not set, the first pointer
793 * that goes down determines the window to which all subsequent touches
794 * go until all pointers go up. When this flag is set, each pointer
795 * (not necessarily the first) that goes down determines the window
796 * to which all subsequent touches of that pointer will go until that
797 * pointer goes up thereby enabling touches with multiple pointers
798 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800799 */
Jeff Brown01ce2e92010-09-26 22:20:12 -0700800 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000801
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800802 /**
Romain Guy72f0a272011-01-09 16:01:46 -0800803 * <p>Indicates whether this window should be hardware accelerated.
804 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800805 *
Romain Guy72f0a272011-01-09 16:01:46 -0800806 * <p>This flag can be controlled programmatically <em>only</em> to enable
807 * hardware acceleration. To enable hardware acceleration for a given
808 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800809 *
Romain Guy72f0a272011-01-09 16:01:46 -0800810 * <pre>
811 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
812 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
813 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
814 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800815 *
Romain Guy72f0a272011-01-09 16:01:46 -0800816 * <p>It is important to remember that this flag <strong>must</strong>
817 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800818 *
Romain Guy72f0a272011-01-09 16:01:46 -0800819 * <p>This flag cannot be used to disable hardware acceleration after it
820 * was enabled in your manifest using
821 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
822 * and programmatically disable hardware acceleration (for automated testing
823 * for instance), make sure it is turned off in your manifest and enable it
824 * on your activity or dialog when you need it instead, using the method
825 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800826 *
Romain Guy72f0a272011-01-09 16:01:46 -0800827 * <p>This flag is automatically set by the system if the
828 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
829 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800830 */
831 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -0400832
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800833 /**
834 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -0800835 * overscan area, if there is one. The window should still correctly
836 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800837 *
838 * <p>This flag can be controlled in your theme through the
839 * {@link android.R.attr#windowOverscan} attribute; this attribute
840 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -0700841 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800842 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
843 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
844 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
845 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
846 *
847 * <p>When this flag is enabled for a window, its normal content may be obscured
848 * to some degree by the overscan region of the display. To ensure key parts of
849 * that content are visible to the user, you can use
850 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
851 * to set the point in the view hierarchy where the appropriate offsets should
852 * be applied. (This can be done either by directly calling this function, using
853 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
854 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
855 * View.fitSystemWindows(Rect)} method).</p>
856 *
857 * <p>This mechanism for positioning content elements is identical to its equivalent
858 * use with layout and {@link View#setSystemUiVisibility(int)
859 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
860 * position its UI elements with this overscan flag is set:</p>
861 *
862 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -0800863 */
864 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
865
John Spurlockbd957402013-10-03 11:38:39 -0400866 /**
867 * Window flag: request a translucent status bar with minimal system-provided
868 * background protection.
869 *
870 * <p>This flag can be controlled in your theme through the
871 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
872 * is automatically set for you in the standard translucent decor themes
873 * such as
874 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
875 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
876 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
877 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
878 *
879 * <p>When this flag is enabled for a window, it automatically sets
880 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
881 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
882 */
883 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
884
885 /**
886 * Window flag: request a translucent navigation bar with minimal system-provided
887 * background protection.
888 *
889 * <p>This flag can be controlled in your theme through the
890 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
891 * is automatically set for you in the standard translucent decor themes
892 * such as
893 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
894 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
895 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
896 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
897 *
898 * <p>When this flag is enabled for a window, it automatically sets
899 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
900 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
901 */
902 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
903
Adam Lesinski6a591f52013-10-01 18:11:17 -0700904 /**
905 * Flag for a window in local focus mode.
906 * Window in local focus mode can control focus independent of window manager using
907 * {@link Window#setLocalFocus(boolean, boolean)}.
908 * Usually window in this mode will not get touch/key events from window manager, but will
909 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
910 */
911 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
912
Jeff Brown98db5fa2011-06-08 15:37:10 -0700913 /** Window flag: Enable touches to slide out of a window into neighboring
914 * windows in mid-gesture instead of being captured for the duration of
915 * the gesture.
916 *
917 * This flag changes the behavior of touch focus for this window only.
918 * Touches can slide out of the window but they cannot necessarily slide
919 * back in (unless the other window with touch focus permits it).
920 *
921 * {@hide}
922 */
Adam Lesinski6a591f52013-10-01 18:11:17 -0700923 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -0700924
Daniel Sandlere02d8082010-10-08 15:13:22 -0400925 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -0700926 * Window flag: When requesting layout with an attached window, the attached window may
927 * overlap with the screen decorations of the parent window such as the navigation bar. By
928 * including this flag, the window manager will layout the attached window within the decor
929 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -0400930 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -0700931 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -0400932
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800933 /**
Adrian Roos217ccd22014-05-09 14:29:04 +0200934 * Flag indicating that this Window is responsible for drawing the background for the
935 * system bars. If set, the system bars are drawn with a transparent background and the
936 * corresponding areas in this window are filled with the colors specified in
937 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
938 */
939 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
940
941 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700942 * Various behavioral options/flags. Default is none.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000943 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700944 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
945 * @see #FLAG_DIM_BEHIND
946 * @see #FLAG_NOT_FOCUSABLE
947 * @see #FLAG_NOT_TOUCHABLE
948 * @see #FLAG_NOT_TOUCH_MODAL
949 * @see #FLAG_TOUCHABLE_WHEN_WAKING
950 * @see #FLAG_KEEP_SCREEN_ON
951 * @see #FLAG_LAYOUT_IN_SCREEN
952 * @see #FLAG_LAYOUT_NO_LIMITS
953 * @see #FLAG_FULLSCREEN
954 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700955 * @see #FLAG_SECURE
956 * @see #FLAG_SCALED
957 * @see #FLAG_IGNORE_CHEEK_PRESSES
958 * @see #FLAG_LAYOUT_INSET_DECOR
959 * @see #FLAG_ALT_FOCUSABLE_IM
960 * @see #FLAG_WATCH_OUTSIDE_TOUCH
961 * @see #FLAG_SHOW_WHEN_LOCKED
962 * @see #FLAG_SHOW_WALLPAPER
963 * @see #FLAG_TURN_SCREEN_ON
964 * @see #FLAG_DISMISS_KEYGUARD
965 * @see #FLAG_SPLIT_TOUCH
966 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -0700967 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +0200968 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700969 */
970 @ViewDebug.ExportedProperty(flagMapping = {
971 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
972 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
973 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
974 name = "FLAG_DIM_BEHIND"),
975 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
976 name = "FLAG_BLUR_BEHIND"),
977 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
978 name = "FLAG_NOT_FOCUSABLE"),
979 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
980 name = "FLAG_NOT_TOUCHABLE"),
981 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
982 name = "FLAG_NOT_TOUCH_MODAL"),
983 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
984 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
985 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
986 name = "FLAG_KEEP_SCREEN_ON"),
987 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
988 name = "FLAG_LAYOUT_IN_SCREEN"),
989 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
990 name = "FLAG_LAYOUT_NO_LIMITS"),
991 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
992 name = "FLAG_FULLSCREEN"),
993 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
994 name = "FLAG_FORCE_NOT_FULLSCREEN"),
995 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
996 name = "FLAG_DITHER"),
997 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
998 name = "FLAG_SECURE"),
999 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
1000 name = "FLAG_SCALED"),
1001 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
1002 name = "FLAG_IGNORE_CHEEK_PRESSES"),
1003 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
1004 name = "FLAG_LAYOUT_INSET_DECOR"),
1005 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
1006 name = "FLAG_ALT_FOCUSABLE_IM"),
1007 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
1008 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
1009 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
1010 name = "FLAG_SHOW_WHEN_LOCKED"),
1011 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
1012 name = "FLAG_SHOW_WALLPAPER"),
1013 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
1014 name = "FLAG_TURN_SCREEN_ON"),
1015 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
1016 name = "FLAG_DISMISS_KEYGUARD"),
1017 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
1018 name = "FLAG_SPLIT_TOUCH"),
1019 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
keunyoung30f420f2013-08-02 14:23:10 -07001020 name = "FLAG_HARDWARE_ACCELERATED"),
1021 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
John Spurlockbd957402013-10-03 11:38:39 -04001022 name = "FLAG_LOCAL_FOCUS_MODE"),
1023 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
1024 name = "FLAG_TRANSLUCENT_STATUS"),
1025 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Adrian Roos217ccd22014-05-09 14:29:04 +02001026 name = "FLAG_TRANSLUCENT_NAVIGATION"),
1027 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
1028 name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001029 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001030 public int flags;
1031
1032 /**
John Reck61375a82014-09-18 19:27:48 +00001033 * If the window has requested hardware acceleration, but this is not
1034 * allowed in the process it is in, then still render it as if it is
1035 * hardware accelerated. This is used for the starting preview windows
1036 * in the system process, which don't need to have the overhead of
1037 * hardware acceleration (they are just a static rendering), but should
1038 * be rendered as such to match the actual window of the app even if it
1039 * is hardware accelerated.
1040 * Even if the window isn't hardware accelerated, still do its rendering
1041 * as if it was.
1042 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1043 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
1044 * is generally disabled. This flag must be specified in addition to
1045 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1046 * windows.
1047 *
1048 * @hide
1049 */
1050 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1051
1052 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001053 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001054 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001055 * If certain parts of the UI that really do want to use hardware
1056 * acceleration, this flag can be set to force it. This is basically
1057 * for the lock screen. Anyone else using it, you are probably wrong.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001058 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001059 * @hide
1060 */
1061 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1062
1063 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001064 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001065 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001066 * them (they do not affect the wallpaper scrolling operation) by calling
1067 * {@link
1068 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1069 *
1070 * @hide
1071 */
1072 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1073
Craig Mautner88400d32012-09-30 12:35:45 -07001074 /** In a multiuser system if this flag is set and the owner is a system process then this
1075 * window will appear on all user screens. This overrides the default behavior of window
1076 * types that normally only appear on the owning user's screen. Refer to each window type
1077 * to determine its default behavior.
1078 *
1079 * {@hide} */
1080 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1081
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001082 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001083 * Never animate position changes of the window.
1084 *
1085 * {@hide} */
1086 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1087
Adam Lesinski6a591f52013-10-01 18:11:17 -07001088 /** Window flag: special flag to limit the size of the window to be
1089 * original size ([320x480] x density). Used to create window for applications
1090 * running under compatibility mode.
1091 *
1092 * {@hide} */
1093 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1094
1095 /** Window flag: a special option intended for system dialogs. When
1096 * this flag is set, the window will demand focus unconditionally when
1097 * it is created.
1098 * {@hide} */
1099 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1100
John Spurlock3f7cd512013-10-07 12:25:09 -04001101 /** Window flag: maintain the previous translucent decor state when this window
John Spurlockbd957402013-10-03 11:38:39 -04001102 * becomes top-most.
1103 * {@hide} */
1104 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
1105
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001106 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001107 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1108 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1109 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1110 * {@hide}
1111 */
1112 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1113
1114 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001115 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1116 *
1117 * {@hide}
1118 */
1119 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1120
1121 /**
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001122 * Flag to force the status bar window to be visible all the time. If the bar is hidden when
1123 * this flag is set it will be shown again and the bar will have a transparent background.
1124 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1125 *
1126 * {@hide}
1127 */
1128 public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000;
1129
1130 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001131 * Control flags that are private to the platform.
1132 * @hide
1133 */
1134 public int privateFlags;
1135
1136 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001137 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1138 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1139 * key. For this case, we should look at windows behind it to determine the appropriate
1140 * value.
1141 *
1142 * @hide
1143 */
1144 public static final int NEEDS_MENU_UNSET = 0;
1145
1146 /**
1147 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1148 * menu key.
1149 *
1150 * @hide
1151 */
1152 public static final int NEEDS_MENU_SET_TRUE = 1;
1153
1154 /**
1155 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1156 * needs a menu key.
1157 *
1158 * @hide
1159 */
1160 public static final int NEEDS_MENU_SET_FALSE = 2;
1161
1162 /**
1163 * State variable for a window belonging to an activity that responds to
1164 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1165 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1166 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1167 *
1168 * (Note that Action Bars, when available, are the preferred way to offer additional
1169 * functions otherwise accessed via an options menu.)
1170 *
1171 * {@hide}
1172 */
1173 public int needsMenuKey = NEEDS_MENU_UNSET;
1174
1175 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001176 * Given a particular set of window manager flags, determine whether
1177 * such a window may be a target for an input method when it has
1178 * focus. In particular, this checks the
1179 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1180 * flags and returns true if the combination of the two corresponds
1181 * to a window that needs to be behind the input method so that the
1182 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001183 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001185 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 * @return Returns true if such a window should be behind/interact
1187 * with an input method, false if not.
1188 */
1189 public static boolean mayUseInputMethod(int flags) {
1190 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
1191 case 0:
1192 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
1193 return true;
1194 }
1195 return false;
1196 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001197
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001198 /**
1199 * Mask for {@link #softInputMode} of the bits that determine the
1200 * desired visibility state of the soft input area for this window.
1201 */
1202 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001203
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204 /**
1205 * Visibility state for {@link #softInputMode}: no state has been specified.
1206 */
1207 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001208
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001209 /**
1210 * Visibility state for {@link #softInputMode}: please don't change the state of
1211 * the soft input area.
1212 */
1213 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001214
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 /**
1216 * Visibility state for {@link #softInputMode}: please hide any soft input
1217 * area when normally appropriate (when the user is navigating
1218 * forward to your window).
1219 */
1220 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001221
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 /**
1223 * Visibility state for {@link #softInputMode}: please always hide any
1224 * soft input area when this window receives focus.
1225 */
1226 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001227
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001228 /**
1229 * Visibility state for {@link #softInputMode}: please show the soft
1230 * input area when normally appropriate (when the user is navigating
1231 * forward to your window).
1232 */
1233 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001234
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 /**
1236 * Visibility state for {@link #softInputMode}: please always make the
1237 * soft input area visible when this window receives input focus.
1238 */
1239 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001240
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001241 /**
1242 * Mask for {@link #softInputMode} of the bits that determine the
1243 * way that the window should be adjusted to accommodate the soft
1244 * input window.
1245 */
1246 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001248 /** Adjustment option for {@link #softInputMode}: nothing specified.
1249 * The system will try to pick one or
1250 * the other depending on the contents of the window.
1251 */
1252 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001253
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001254 /** Adjustment option for {@link #softInputMode}: set to allow the
1255 * window to be resized when an input
1256 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07001257 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001258 * {@link #SOFT_INPUT_ADJUST_PAN}; if
1259 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07001260 * the other depending on the contents of the window. If the window's
1261 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
1262 * value for {@link #softInputMode} will be ignored; the window will
1263 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001264 */
1265 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001266
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001267 /** Adjustment option for {@link #softInputMode}: set to have a window
1268 * pan when an input method is
1269 * shown, so it doesn't need to deal with resizing but just panned
1270 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07001271 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001272 * neither of these are set, then the system will try to pick one or
1273 * the other depending on the contents of the window.
1274 */
1275 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001276
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001277 /** Adjustment option for {@link #softInputMode}: set to have a window
1278 * not adjust for a shown input method. The window will not be resized,
1279 * and it will not be panned to make its focus visible.
1280 */
1281 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
1282
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001283 /**
1284 * Bit for {@link #softInputMode}: set when the user has navigated
1285 * forward to the window. This is normally set automatically for
1286 * you by the system, though you may want to set it in certain cases
1287 * when you are displaying a window yourself. This flag will always
1288 * be cleared automatically after the window is displayed.
1289 */
1290 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001291
1292 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08001293 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001294 * of:
Wonsik Kim475e3f02014-03-17 11:17:47 +00001295 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001296 * <ul>
1297 * <li> One of the visibility states
1298 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
1299 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or
1300 * {@link #SOFT_INPUT_STATE_VISIBLE}.
1301 * <li> One of the adjustment options
1302 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},
1303 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or
1304 * {@link #SOFT_INPUT_ADJUST_PAN}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001305 * </ul>
1306 *
1307 *
1308 * <p>This flag can be controlled in your theme through the
1309 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001310 */
1311 public int softInputMode;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001312
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001313 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001314 * Placement of window within the screen as per {@link Gravity}. Both
1315 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1316 * android.graphics.Rect) Gravity.apply} and
1317 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1318 * Gravity.applyDisplay} are used during window layout, with this value
1319 * given as the desired gravity. For example you can specify
1320 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
1321 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
1322 * to control the behavior of
1323 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1324 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001325 *
1326 * @see Gravity
1327 */
1328 public int gravity;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001329
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001330 /**
1331 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001332 * between the container and the widget. See
1333 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1334 * android.graphics.Rect) Gravity.apply} for how this is used. This
1335 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 */
1337 public float horizontalMargin;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001338
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001339 /**
1340 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001341 * between the container and the widget. See
1342 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1343 * android.graphics.Rect) Gravity.apply} for how this is used. This
1344 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001345 */
1346 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001347
1348 /**
1349 * Positive insets between the drawing surface and window content.
1350 *
1351 * @hide
1352 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07001353 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08001354
1355 /**
1356 * Whether the surface insets have been manually set. When set to
1357 * {@code false}, the view root will automatically determine the
1358 * appropriate surface insets.
1359 *
1360 * @see #surfaceInsets
1361 * @hide
1362 */
1363 public boolean hasManualSurfaceInsets;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001364
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001365 /**
1366 * The desired bitmap format. May be one of the constants in
1367 * {@link android.graphics.PixelFormat}. Default is OPAQUE.
1368 */
1369 public int format;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001371 /**
1372 * A style resource defining the animations to use for this window.
1373 * This must be a system resource; it can not be an application resource
1374 * because the window manager does not have access to applications.
1375 */
1376 public int windowAnimations;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001377
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001378 /**
1379 * An alpha value to apply to this entire window.
1380 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1381 */
1382 public float alpha = 1.0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001383
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 /**
1385 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1386 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1387 * dim.
1388 */
1389 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001390
1391 /**
1392 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1393 * indicating that the brightness value is not overridden for this window
1394 * and normal brightness policy should be used.
1395 */
1396 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1397
1398 /**
1399 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1400 * indicating that the screen or button backlight brightness should be set
1401 * to the lowest value when this window is in front.
1402 */
1403 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1404
1405 /**
1406 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1407 * indicating that the screen or button backlight brightness should be set
1408 * to the hightest value when this window is in front.
1409 */
1410 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001411
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 /**
1413 * This can be used to override the user's preferred brightness of
1414 * the screen. A value of less than 0, the default, means to use the
1415 * preferred screen brightness. 0 to 1 adjusts the brightness from
1416 * dark to full bright.
1417 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001418 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001419
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001420 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001421 * This can be used to override the standard behavior of the button and
1422 * keyboard backlights. A value of less than 0, the default, means to
1423 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1424 * from dark to full bright.
1425 */
1426 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1427
1428 /**
Craig Mautner3c174372013-02-21 17:54:37 -08001429 * Value for {@link #rotationAnimation} to define the animation used to
1430 * specify that this window will rotate in or out following a rotation.
1431 */
1432 public static final int ROTATION_ANIMATION_ROTATE = 0;
1433
1434 /**
1435 * Value for {@link #rotationAnimation} to define the animation used to
1436 * specify that this window will fade in or out following a rotation.
1437 */
1438 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
1439
1440 /**
1441 * Value for {@link #rotationAnimation} to define the animation used to
1442 * specify that this window will immediately disappear or appear following
1443 * a rotation.
1444 */
1445 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
1446
1447 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001448 * Define the exit and entry animations used on this window when the device is rotated.
1449 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08001450 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001451 * by other windows. All other situations default to the
1452 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001453 *
Craig Mautner3c174372013-02-21 17:54:37 -08001454 * @see #ROTATION_ANIMATION_ROTATE
1455 * @see #ROTATION_ANIMATION_CROSSFADE
1456 * @see #ROTATION_ANIMATION_JUMPCUT
1457 */
1458 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
1459
1460 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001461 * Identifier for this window. This will usually be filled in for
1462 * you.
1463 */
1464 public IBinder token = null;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001465
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001466 /**
1467 * Name of the package owning this window.
1468 */
1469 public String packageName = null;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001470
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001471 /**
1472 * Specific orientation value for a window.
1473 * May be any of the same values allowed
Wonsik Kim475e3f02014-03-17 11:17:47 +00001474 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1475 * If not set, a default value of
1476 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001477 * will be used.
1478 */
1479 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001480
1481 /**
Michael Wright3f145a22014-07-22 19:46:03 -07001482 * The preferred refresh rate for the window.
1483 *
1484 * This must be one of the supported refresh rates obtained for the display(s) the window
1485 * is on.
1486 *
1487 * @see Display#getSupportedRefreshRates()
1488 */
1489 public float preferredRefreshRate;
1490
1491 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001492 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001493 *
1494 * @see View#STATUS_BAR_VISIBLE
1495 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001496 */
1497 public int systemUiVisibility;
1498
1499 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001500 * @hide
1501 * The ui visibility as requested by the views in this hierarchy.
1502 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1503 */
1504 public int subtreeSystemUiVisibility;
1505
1506 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001507 * Get callbacks about the system ui visibility changing.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001508 *
Joe Onorato664644d2011-01-23 17:53:23 -08001509 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1510 *
1511 * @hide
1512 */
1513 public boolean hasSystemUiListeners;
1514
Jeff Brown474dcb52011-06-14 20:22:50 -07001515 /**
1516 * When this window has focus, disable touch pad pointer gesture processing.
1517 * The window will receive raw position updates from the touch pad instead
1518 * of pointer movements and synthetic touch events.
1519 *
1520 * @hide
1521 */
1522 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1523
1524 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001525 * Does not construct an input channel for this window. The channel will therefore
1526 * be incapable of receiving input.
1527 *
1528 * @hide
1529 */
1530 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1531
1532 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001533 * When this window has focus, does not call user activity for all input events so
1534 * the application will have to do it itself. Should only be used by
1535 * the keyguard and phone app.
1536 * <p>
1537 * Should only be used by the keyguard and phone app.
1538 * </p>
1539 *
1540 * @hide
1541 */
1542 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
1543
1544 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001545 * Control special features of the input subsystem.
1546 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001547 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001548 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001549 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07001550 * @hide
1551 */
1552 public int inputFeatures;
1553
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001554 /**
1555 * Sets the number of milliseconds before the user activity timeout occurs
1556 * when this window has focus. A value of -1 uses the standard timeout.
1557 * A value of 0 uses the minimum support display timeout.
1558 * <p>
1559 * This property can only be used to reduce the user specified display timeout;
1560 * it can never make the timeout longer than it normally would be.
1561 * </p><p>
1562 * Should only be used by the keyguard and phone app.
1563 * </p>
1564 *
1565 * @hide
1566 */
1567 public long userActivityTimeout = -1;
1568
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001569 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001570 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001571 type = TYPE_APPLICATION;
1572 format = PixelFormat.OPAQUE;
1573 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001575 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001576 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001577 type = _type;
1578 format = PixelFormat.OPAQUE;
1579 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001580
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001581 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001582 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001583 type = _type;
1584 flags = _flags;
1585 format = PixelFormat.OPAQUE;
1586 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001587
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001588 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08001589 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001590 type = _type;
1591 flags = _flags;
1592 format = _format;
1593 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001594
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001595 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
1596 super(w, h);
1597 type = _type;
1598 flags = _flags;
1599 format = _format;
1600 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001601
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001602 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
1603 int _flags, int _format) {
1604 super(w, h);
1605 x = xpos;
1606 y = ypos;
1607 type = _type;
1608 flags = _flags;
1609 format = _format;
1610 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001611
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001612 public final void setTitle(CharSequence title) {
1613 if (null == title)
1614 title = "";
Wonsik Kim475e3f02014-03-17 11:17:47 +00001615
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001616 mTitle = TextUtils.stringOrSpannedString(title);
1617 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001618
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001619 public final CharSequence getTitle() {
1620 return mTitle;
1621 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08001622
1623 /** @hide */
1624 @SystemApi
1625 public final void setUserActivityTimeout(long timeout) {
1626 userActivityTimeout = timeout;
1627 }
1628
1629 /** @hide */
1630 @SystemApi
1631 public final long getUserActivityTimeout() {
1632 return userActivityTimeout;
1633 }
1634
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001635 public int describeContents() {
1636 return 0;
1637 }
1638
1639 public void writeToParcel(Parcel out, int parcelableFlags) {
1640 out.writeInt(width);
1641 out.writeInt(height);
1642 out.writeInt(x);
1643 out.writeInt(y);
1644 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001645 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001646 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001647 out.writeInt(softInputMode);
1648 out.writeInt(gravity);
1649 out.writeFloat(horizontalMargin);
1650 out.writeFloat(verticalMargin);
1651 out.writeInt(format);
1652 out.writeInt(windowAnimations);
1653 out.writeFloat(alpha);
1654 out.writeFloat(dimAmount);
1655 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001656 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08001657 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001658 out.writeStrongBinder(token);
1659 out.writeString(packageName);
1660 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
1661 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07001662 out.writeFloat(preferredRefreshRate);
Joe Onorato664644d2011-01-23 17:53:23 -08001663 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08001664 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08001665 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07001666 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001667 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07001668 out.writeInt(surfaceInsets.left);
1669 out.writeInt(surfaceInsets.top);
1670 out.writeInt(surfaceInsets.right);
1671 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08001672 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001673 out.writeInt(needsMenuKey);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001674 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001675
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001676 public static final Parcelable.Creator<LayoutParams> CREATOR
1677 = new Parcelable.Creator<LayoutParams>() {
1678 public LayoutParams createFromParcel(Parcel in) {
1679 return new LayoutParams(in);
1680 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001681
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001682 public LayoutParams[] newArray(int size) {
1683 return new LayoutParams[size];
1684 }
1685 };
Wonsik Kim475e3f02014-03-17 11:17:47 +00001686
1687
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001688 public LayoutParams(Parcel in) {
1689 width = in.readInt();
1690 height = in.readInt();
1691 x = in.readInt();
1692 y = in.readInt();
1693 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001694 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001695 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001696 softInputMode = in.readInt();
1697 gravity = in.readInt();
1698 horizontalMargin = in.readFloat();
1699 verticalMargin = in.readFloat();
1700 format = in.readInt();
1701 windowAnimations = in.readInt();
1702 alpha = in.readFloat();
1703 dimAmount = in.readFloat();
1704 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001705 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08001706 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001707 token = in.readStrongBinder();
1708 packageName = in.readString();
1709 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
1710 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07001711 preferredRefreshRate = in.readFloat();
Joe Onorato664644d2011-01-23 17:53:23 -08001712 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08001713 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001714 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07001715 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001716 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07001717 surfaceInsets.left = in.readInt();
1718 surfaceInsets.top = in.readInt();
1719 surfaceInsets.right = in.readInt();
1720 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08001721 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001722 needsMenuKey = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001723 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001724
Romain Guy72998072009-06-22 11:09:20 -07001725 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001726 public static final int LAYOUT_CHANGED = 1<<0;
1727 public static final int TYPE_CHANGED = 1<<1;
1728 public static final int FLAGS_CHANGED = 1<<2;
1729 public static final int FORMAT_CHANGED = 1<<3;
1730 public static final int ANIMATION_CHANGED = 1<<4;
1731 public static final int DIM_AMOUNT_CHANGED = 1<<5;
1732 public static final int TITLE_CHANGED = 1<<6;
1733 public static final int ALPHA_CHANGED = 1<<7;
1734 public static final int MEMORY_TYPE_CHANGED = 1<<8;
1735 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
1736 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
1737 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08001738 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001739 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001740 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08001741 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001742 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08001743 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001744 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07001745 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001746 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001747 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001748 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07001749 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001750 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001751 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04001752 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
1753 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07001754 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001755 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07001756 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
1757 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001758 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
1759 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07001760 public static final int EVERYTHING_CHANGED = 0xffffffff;
1761
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001762 // internal buffer to backup/restore parameters under compatibility mode.
1763 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001764
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001765 public final int copyFrom(LayoutParams o) {
1766 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001767
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001768 if (width != o.width) {
1769 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07001770 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001771 }
1772 if (height != o.height) {
1773 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07001774 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001775 }
1776 if (x != o.x) {
1777 x = o.x;
1778 changes |= LAYOUT_CHANGED;
1779 }
1780 if (y != o.y) {
1781 y = o.y;
1782 changes |= LAYOUT_CHANGED;
1783 }
1784 if (horizontalWeight != o.horizontalWeight) {
1785 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001786 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001787 }
1788 if (verticalWeight != o.verticalWeight) {
1789 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001790 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001791 }
1792 if (horizontalMargin != o.horizontalMargin) {
1793 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001794 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001795 }
1796 if (verticalMargin != o.verticalMargin) {
1797 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001798 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001799 }
1800 if (type != o.type) {
1801 type = o.type;
1802 changes |= TYPE_CHANGED;
1803 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001804 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04001805 final int diff = flags ^ o.flags;
1806 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
1807 changes |= TRANSLUCENT_FLAGS_CHANGED;
1808 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001809 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07001810 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001811 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001812 if (privateFlags != o.privateFlags) {
1813 privateFlags = o.privateFlags;
1814 changes |= PRIVATE_FLAGS_CHANGED;
1815 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001816 if (softInputMode != o.softInputMode) {
1817 softInputMode = o.softInputMode;
1818 changes |= SOFT_INPUT_MODE_CHANGED;
1819 }
1820 if (gravity != o.gravity) {
1821 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07001822 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001823 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001824 if (format != o.format) {
1825 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07001826 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001827 }
1828 if (windowAnimations != o.windowAnimations) {
1829 windowAnimations = o.windowAnimations;
1830 changes |= ANIMATION_CHANGED;
1831 }
1832 if (token == null) {
1833 // NOTE: token only copied if the recipient doesn't
1834 // already have one.
1835 token = o.token;
1836 }
1837 if (packageName == null) {
1838 // NOTE: packageName only copied if the recipient doesn't
1839 // already have one.
1840 packageName = o.packageName;
1841 }
1842 if (!mTitle.equals(o.mTitle)) {
1843 mTitle = o.mTitle;
1844 changes |= TITLE_CHANGED;
1845 }
1846 if (alpha != o.alpha) {
1847 alpha = o.alpha;
1848 changes |= ALPHA_CHANGED;
1849 }
1850 if (dimAmount != o.dimAmount) {
1851 dimAmount = o.dimAmount;
1852 changes |= DIM_AMOUNT_CHANGED;
1853 }
1854 if (screenBrightness != o.screenBrightness) {
1855 screenBrightness = o.screenBrightness;
1856 changes |= SCREEN_BRIGHTNESS_CHANGED;
1857 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001858 if (buttonBrightness != o.buttonBrightness) {
1859 buttonBrightness = o.buttonBrightness;
1860 changes |= BUTTON_BRIGHTNESS_CHANGED;
1861 }
Craig Mautner3c174372013-02-21 17:54:37 -08001862 if (rotationAnimation != o.rotationAnimation) {
1863 rotationAnimation = o.rotationAnimation;
1864 changes |= ROTATION_ANIMATION_CHANGED;
1865 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001866
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001867 if (screenOrientation != o.screenOrientation) {
1868 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07001869 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001870 }
Romain Guy529b60a2010-08-03 18:05:47 -07001871
Michael Wright3f145a22014-07-22 19:46:03 -07001872 if (preferredRefreshRate != o.preferredRefreshRate) {
1873 preferredRefreshRate = o.preferredRefreshRate;
1874 changes |= PREFERRED_REFRESH_RATE_CHANGED;
1875 }
1876
Joe Onorato14782f72011-01-25 19:53:17 -08001877 if (systemUiVisibility != o.systemUiVisibility
1878 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08001879 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08001880 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08001881 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
1882 }
1883
1884 if (hasSystemUiListeners != o.hasSystemUiListeners) {
1885 hasSystemUiListeners = o.hasSystemUiListeners;
1886 changes |= SYSTEM_UI_LISTENER_CHANGED;
1887 }
1888
Jeff Brown474dcb52011-06-14 20:22:50 -07001889 if (inputFeatures != o.inputFeatures) {
1890 inputFeatures = o.inputFeatures;
1891 changes |= INPUT_FEATURES_CHANGED;
1892 }
1893
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001894 if (userActivityTimeout != o.userActivityTimeout) {
1895 userActivityTimeout = o.userActivityTimeout;
1896 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
1897 }
1898
Alan Viverette49a22e82014-07-12 20:01:27 -07001899 if (!surfaceInsets.equals(o.surfaceInsets)) {
1900 surfaceInsets.set(o.surfaceInsets);
1901 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001902 }
1903
Alan Viverette5435a302015-01-29 10:25:34 -08001904 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
1905 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
1906 changes |= SURFACE_INSETS_CHANGED;
1907 }
1908
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001909 if (needsMenuKey != o.needsMenuKey) {
1910 needsMenuKey = o.needsMenuKey;
1911 changes |= NEEDS_MENU_KEY_CHANGED;
1912 }
1913
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001914 return changes;
1915 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001916
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001917 @Override
1918 public String debug(String output) {
1919 output += "Contents of " + this + ":";
1920 Log.d("Debug", output);
1921 output = super.debug("");
1922 Log.d("Debug", output);
1923 Log.d("Debug", "");
1924 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
1925 return "";
1926 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001927
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001928 @Override
1929 public String toString() {
1930 StringBuilder sb = new StringBuilder(256);
1931 sb.append("WM.LayoutParams{");
1932 sb.append("(");
1933 sb.append(x);
1934 sb.append(',');
1935 sb.append(y);
1936 sb.append(")(");
Romain Guy980a9382010-01-08 15:06:28 -08001937 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001938 sb.append('x');
Romain Guy980a9382010-01-08 15:06:28 -08001939 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001940 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001941 if (horizontalMargin != 0) {
1942 sb.append(" hm=");
1943 sb.append(horizontalMargin);
1944 }
1945 if (verticalMargin != 0) {
1946 sb.append(" vm=");
1947 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001948 }
1949 if (gravity != 0) {
1950 sb.append(" gr=#");
1951 sb.append(Integer.toHexString(gravity));
1952 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001953 if (softInputMode != 0) {
1954 sb.append(" sim=#");
1955 sb.append(Integer.toHexString(softInputMode));
1956 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001957 sb.append(" ty=");
1958 sb.append(type);
1959 sb.append(" fl=#");
1960 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001961 if (privateFlags != 0) {
Adam Lesinski95c42972013-10-02 10:13:27 -07001962 if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
1963 sb.append(" compatible=true");
1964 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001965 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
1966 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001967 if (format != PixelFormat.OPAQUE) {
1968 sb.append(" fmt=");
1969 sb.append(format);
1970 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001971 if (windowAnimations != 0) {
1972 sb.append(" wanim=0x");
1973 sb.append(Integer.toHexString(windowAnimations));
1974 }
1975 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
1976 sb.append(" or=");
1977 sb.append(screenOrientation);
1978 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001979 if (alpha != 1.0f) {
1980 sb.append(" alpha=");
1981 sb.append(alpha);
1982 }
1983 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1984 sb.append(" sbrt=");
1985 sb.append(screenBrightness);
1986 }
1987 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1988 sb.append(" bbrt=");
1989 sb.append(buttonBrightness);
1990 }
Craig Mautner3c174372013-02-21 17:54:37 -08001991 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
1992 sb.append(" rotAnim=");
1993 sb.append(rotationAnimation);
1994 }
Michael Wright3f145a22014-07-22 19:46:03 -07001995 if (preferredRefreshRate != 0) {
1996 sb.append(" preferredRefreshRate=");
1997 sb.append(preferredRefreshRate);
1998 }
Joe Onorato664644d2011-01-23 17:53:23 -08001999 if (systemUiVisibility != 0) {
2000 sb.append(" sysui=0x");
2001 sb.append(Integer.toHexString(systemUiVisibility));
2002 }
Joe Onorato14782f72011-01-25 19:53:17 -08002003 if (subtreeSystemUiVisibility != 0) {
2004 sb.append(" vsysui=0x");
2005 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
2006 }
Joe Onorato664644d2011-01-23 17:53:23 -08002007 if (hasSystemUiListeners) {
2008 sb.append(" sysuil=");
2009 sb.append(hasSystemUiListeners);
2010 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07002011 if (inputFeatures != 0) {
2012 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
2013 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002014 if (userActivityTimeout >= 0) {
2015 sb.append(" userActivityTimeout=").append(userActivityTimeout);
2016 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07002017 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Andreas Gampe11090062015-03-16 09:45:34 -07002018 surfaceInsets.bottom != 0 || hasManualSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07002019 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08002020 if (hasManualSurfaceInsets) {
2021 sb.append(" (manual)");
2022 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07002023 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002024 if (needsMenuKey != NEEDS_MENU_UNSET) {
2025 sb.append(" needsMenuKey=");
2026 sb.append(needsMenuKey);
2027 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002028 sb.append('}');
2029 return sb.toString();
2030 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002031
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002032 /**
2033 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002034 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002035 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002036 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002037 x = (int) (x * scale + 0.5f);
2038 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002039 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002040 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002041 }
2042 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002043 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002044 }
2045 }
2046
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002047 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002048 * Backup the layout parameters used in compatibility mode.
2049 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002050 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002051 void backup() {
2052 int[] backup = mCompatibilityParamsBackup;
2053 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002054 // we backup 4 elements, x, y, width, height
2055 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002056 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002057 backup[0] = x;
2058 backup[1] = y;
2059 backup[2] = width;
2060 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002061 }
2062
2063 /**
2064 * Restore the layout params' coordinates, size and gravity
2065 * @see LayoutParams#backup()
2066 */
2067 void restore() {
2068 int[] backup = mCompatibilityParamsBackup;
2069 if (backup != null) {
2070 x = backup[0];
2071 y = backup[1];
2072 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002073 height = backup[3];
2074 }
2075 }
2076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002077 private CharSequence mTitle = "";
Siva Velusamy0d857b92015-04-22 10:23:56 -07002078
2079 /** @hide */
2080 @Override
2081 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
2082 super.encodeProperties(encoder);
2083
2084 encoder.addProperty("x", x);
2085 encoder.addProperty("y", y);
2086 encoder.addProperty("horizontalWeight", horizontalWeight);
2087 encoder.addProperty("verticalWeight", verticalWeight);
2088 encoder.addProperty("type", type);
2089 encoder.addProperty("flags", flags);
2090 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002091 }
2092}