blob: e56a82ffabd20f857c2f0f66babbaa97239f887f [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
Jorim Jaggif12ec0f2017-08-23 16:14:10 +020019import android.Manifest.permission;
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080020import android.annotation.IntDef;
Siva Velusamy0d857b92015-04-22 10:23:56 -070021import android.annotation.NonNull;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040022import android.annotation.RequiresPermission;
Bryce Lee53b9fbd2015-02-06 12:06:34 -080023import android.annotation.SystemApi;
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060024import android.annotation.SystemService;
Robert Carrb48380a2017-04-04 14:56:37 -070025import android.annotation.TestApi;
Jorim Jaggi241ae102016-11-02 21:57:33 -070026import android.app.KeyguardManager;
Jeff Browna492c3a2012-08-23 19:48:44 -070027import android.app.Presentation;
28import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.pm.ActivityInfo;
30import android.graphics.PixelFormat;
Alan Viveretteccb11e12014-07-08 16:04:02 -070031import android.graphics.Rect;
Albert Chaulk2ccb0b72017-06-20 14:39:29 -040032import android.graphics.Region;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.os.IBinder;
34import android.os.Parcel;
35import android.os.Parcelable;
36import android.text.TextUtils;
37import android.util.Log;
Steven Timotiusaf03df62017-07-18 16:56:43 -070038import android.util.proto.ProtoOutputStream;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039
Yohei Yukawa22dac1c2017-02-12 16:54:16 -080040import java.lang.annotation.Retention;
41import java.lang.annotation.RetentionPolicy;
Clara Bayarri75e09792015-07-29 16:20:40 +010042import java.util.List;
Wale Ogunwale1f240c92016-02-22 18:04:58 -080043import java.util.Objects;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044
45/**
46 * The interface that apps use to talk to the window manager.
Jeff Browna492c3a2012-08-23 19:48:44 -070047 * </p><p>
48 * Each window manager instance is bound to a particular {@link Display}.
49 * To obtain a {@link WindowManager} for a different display, use
50 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
51 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
52 * to get the WindowManager.
53 * </p><p>
54 * The simplest way to show a window on another display is to create a
55 * {@link Presentation}. The presentation will automatically obtain a
56 * {@link WindowManager} and {@link Context} for that display.
57 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058 */
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060059@SystemService(Context.WINDOW_SERVICE)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060public interface WindowManager extends ViewManager {
Jorim Jaggi61f39a72015-10-29 16:54:18 +010061
62 /** @hide */
63 int DOCKED_INVALID = -1;
64 /** @hide */
65 int DOCKED_LEFT = 1;
66 /** @hide */
67 int DOCKED_TOP = 2;
68 /** @hide */
69 int DOCKED_RIGHT = 3;
70 /** @hide */
71 int DOCKED_BOTTOM = 4;
72
Winson41275482016-10-10 15:17:45 -070073 /** @hide */
74 final static String INPUT_CONSUMER_PIP = "pip_input_consumer";
75 /** @hide */
76 final static String INPUT_CONSUMER_NAVIGATION = "nav_input_consumer";
77 /** @hide */
78 final static String INPUT_CONSUMER_WALLPAPER = "wallpaper_input_consumer";
79
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +010082 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 * is invalid.
84 */
85 public static class BadTokenException extends RuntimeException {
86 public BadTokenException() {
87 }
88
89 public BadTokenException(String name) {
90 super(name);
91 }
92 }
93
94 /**
Craig Mautner6018aee2012-10-23 14:27:49 -070095 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
96 * be found. See {@link android.app.Presentation} for more information on secondary displays.
97 */
98 public static class InvalidDisplayException extends RuntimeException {
99 public InvalidDisplayException() {
100 }
101
102 public InvalidDisplayException(String name) {
103 super(name);
104 }
105 }
106
107 /**
Jeff Browna492c3a2012-08-23 19:48:44 -0700108 * Returns the {@link Display} upon which this {@link WindowManager} instance
109 * will create new windows.
110 * <p>
111 * Despite the name of this method, the display that is returned is not
112 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
113 * The returned display could instead be a secondary display that this
114 * window manager instance is managing. Think of it as the display that
115 * this {@link WindowManager} instance uses by default.
116 * </p><p>
117 * To create windows on a different display, you need to obtain a
118 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
119 * class documentation for more information.)
120 * </p>
121 *
122 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800123 */
124 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -0700125
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800126 /**
127 * Special variation of {@link #removeView} that immediately invokes
128 * the given view hierarchy's {@link View#onDetachedFromWindow()
129 * View.onDetachedFromWindow()} methods before returning. This is not
130 * for normal applications; using it correctly requires great care.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700131 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 * @param view The view to be removed.
133 */
134 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700135
Clara Bayarri75e09792015-07-29 16:20:40 +0100136 /**
137 * Used to asynchronously request Keyboard Shortcuts from the focused window.
138 *
139 * @hide
140 */
141 public interface KeyboardShortcutsReceiver {
142 /**
143 * Callback used when the focused window keyboard shortcuts are ready to be displayed.
144 *
145 * @param result The keyboard shortcuts to be displayed.
146 */
147 void onKeyboardShortcutsReceived(List<KeyboardShortcutGroup> result);
148 }
149
150 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -0800151 * Message for taking fullscreen screenshot
152 * @hide
153 */
154 final int TAKE_SCREENSHOT_FULLSCREEN = 1;
155
156 /**
157 * Message for taking screenshot of selected region.
158 * @hide
159 */
160 final int TAKE_SCREENSHOT_SELECTED_REGION = 2;
161
162 /**
Clara Bayarri75e09792015-07-29 16:20:40 +0100163 * @hide
164 */
165 public static final String PARCEL_KEY_SHORTCUTS_ARRAY = "shortcuts_array";
166
167 /**
168 * Request for keyboard shortcuts to be retrieved asynchronously.
169 *
170 * @param receiver The callback to be triggered when the result is ready.
171 *
172 * @hide
173 */
Clara Bayarrifcd7e802016-03-10 12:58:18 +0000174 public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId);
Clara Bayarri75e09792015-07-29 16:20:40 +0100175
Albert Chaulk2ccb0b72017-06-20 14:39:29 -0400176 /**
177 * Return the touch region for the current IME window, or an empty region if there is none.
178 *
179 * @return The region of the IME that is accepting touch inputs, or null if there is no IME, no
180 * region or there was an error.
181 *
182 * @hide
183 */
184 @SystemApi
185 @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
186 public Region getCurrentImeTouchRegion();
187
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -0800188 public static class LayoutParams extends ViewGroup.LayoutParams implements Parcelable {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800189 /**
190 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700191 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
192 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800193 */
Romain Guy529b60a2010-08-03 18:05:47 -0700194 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800195 public int x;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700196
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800197 /**
198 * Y position for this window. With the default gravity it is ignored.
199 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
200 * an offset from the given edge.
201 */
Romain Guy529b60a2010-08-03 18:05:47 -0700202 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800203 public int y;
204
205 /**
206 * Indicates how much of the extra space will be allocated horizontally
207 * to the view associated with these LayoutParams. Specify 0 if the view
208 * should not be stretched. Otherwise the extra pixels will be pro-rated
209 * among all views whose weight is greater than 0.
210 */
Romain Guy529b60a2010-08-03 18:05:47 -0700211 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800212 public float horizontalWeight;
213
214 /**
215 * Indicates how much of the extra space will be allocated vertically
216 * to the view associated with these LayoutParams. Specify 0 if the view
217 * should not be stretched. Otherwise the extra pixels will be pro-rated
218 * among all views whose weight is greater than 0.
219 */
Romain Guy529b60a2010-08-03 18:05:47 -0700220 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800221 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700222
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800223 /**
224 * The general type of window. There are three main classes of
225 * window types:
226 * <ul>
227 * <li> <strong>Application windows</strong> (ranging from
228 * {@link #FIRST_APPLICATION_WINDOW} to
229 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
230 * windows. For these types of windows, the {@link #token} must be
231 * set to the token of the activity they are a part of (this will
232 * normally be done for you if {@link #token} is null).
233 * <li> <strong>Sub-windows</strong> (ranging from
234 * {@link #FIRST_SUB_WINDOW} to
235 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
236 * window. For these types of windows, the {@link #token} must be
237 * the token of the window it is attached to.
238 * <li> <strong>System windows</strong> (ranging from
239 * {@link #FIRST_SYSTEM_WINDOW} to
240 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
241 * use by the system for specific purposes. They should not normally
242 * be used by applications, and a special permission is required
243 * to use them.
244 * </ul>
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700245 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800246 * @see #TYPE_BASE_APPLICATION
247 * @see #TYPE_APPLICATION
248 * @see #TYPE_APPLICATION_STARTING
Chong Zhangfea963e2016-08-15 17:14:16 -0700249 * @see #TYPE_DRAWN_APPLICATION
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 * @see #TYPE_APPLICATION_PANEL
251 * @see #TYPE_APPLICATION_MEDIA
252 * @see #TYPE_APPLICATION_SUB_PANEL
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700253 * @see #TYPE_APPLICATION_ABOVE_SUB_PANEL
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800254 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
255 * @see #TYPE_STATUS_BAR
256 * @see #TYPE_SEARCH_BAR
257 * @see #TYPE_PHONE
258 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800259 * @see #TYPE_TOAST
260 * @see #TYPE_SYSTEM_OVERLAY
261 * @see #TYPE_PRIORITY_PHONE
262 * @see #TYPE_STATUS_BAR_PANEL
263 * @see #TYPE_SYSTEM_DIALOG
264 * @see #TYPE_KEYGUARD_DIALOG
265 * @see #TYPE_SYSTEM_ERROR
266 * @see #TYPE_INPUT_METHOD
267 * @see #TYPE_INPUT_METHOD_DIALOG
268 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700269 @ViewDebug.ExportedProperty(mapping = {
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700270 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION,
271 to = "TYPE_BASE_APPLICATION"),
272 @ViewDebug.IntToString(from = TYPE_APPLICATION,
273 to = "TYPE_APPLICATION"),
274 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING,
275 to = "TYPE_APPLICATION_STARTING"),
276 @ViewDebug.IntToString(from = TYPE_DRAWN_APPLICATION,
277 to = "TYPE_DRAWN_APPLICATION"),
278 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL,
279 to = "TYPE_APPLICATION_PANEL"),
280 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA,
281 to = "TYPE_APPLICATION_MEDIA"),
282 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL,
283 to = "TYPE_APPLICATION_SUB_PANEL"),
284 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL,
285 to = "TYPE_APPLICATION_ABOVE_SUB_PANEL"),
286 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG,
287 to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
288 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY,
289 to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
290 @ViewDebug.IntToString(from = TYPE_STATUS_BAR,
291 to = "TYPE_STATUS_BAR"),
292 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR,
293 to = "TYPE_SEARCH_BAR"),
294 @ViewDebug.IntToString(from = TYPE_PHONE,
295 to = "TYPE_PHONE"),
296 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT,
297 to = "TYPE_SYSTEM_ALERT"),
298 @ViewDebug.IntToString(from = TYPE_TOAST,
299 to = "TYPE_TOAST"),
300 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY,
301 to = "TYPE_SYSTEM_OVERLAY"),
302 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE,
303 to = "TYPE_PRIORITY_PHONE"),
304 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG,
305 to = "TYPE_SYSTEM_DIALOG"),
306 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG,
307 to = "TYPE_KEYGUARD_DIALOG"),
308 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR,
309 to = "TYPE_SYSTEM_ERROR"),
310 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD,
311 to = "TYPE_INPUT_METHOD"),
312 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG,
313 to = "TYPE_INPUT_METHOD_DIALOG"),
314 @ViewDebug.IntToString(from = TYPE_WALLPAPER,
315 to = "TYPE_WALLPAPER"),
316 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL,
317 to = "TYPE_STATUS_BAR_PANEL"),
318 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY,
319 to = "TYPE_SECURE_SYSTEM_OVERLAY"),
320 @ViewDebug.IntToString(from = TYPE_DRAG,
321 to = "TYPE_DRAG"),
322 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL,
323 to = "TYPE_STATUS_BAR_SUB_PANEL"),
324 @ViewDebug.IntToString(from = TYPE_POINTER,
325 to = "TYPE_POINTER"),
326 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR,
327 to = "TYPE_NAVIGATION_BAR"),
328 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY,
329 to = "TYPE_VOLUME_OVERLAY"),
330 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS,
331 to = "TYPE_BOOT_PROGRESS"),
332 @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER,
333 to = "TYPE_INPUT_CONSUMER"),
334 @ViewDebug.IntToString(from = TYPE_DREAM,
335 to = "TYPE_DREAM"),
336 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL,
337 to = "TYPE_NAVIGATION_BAR_PANEL"),
338 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY,
339 to = "TYPE_DISPLAY_OVERLAY"),
340 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY,
341 to = "TYPE_MAGNIFICATION_OVERLAY"),
342 @ViewDebug.IntToString(from = TYPE_PRESENTATION,
343 to = "TYPE_PRESENTATION"),
344 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION,
345 to = "TYPE_PRIVATE_PRESENTATION"),
346 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION,
347 to = "TYPE_VOICE_INTERACTION"),
348 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING,
349 to = "TYPE_VOICE_INTERACTION_STARTING"),
350 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER,
351 to = "TYPE_DOCK_DIVIDER"),
352 @ViewDebug.IntToString(from = TYPE_QS_DIALOG,
353 to = "TYPE_QS_DIALOG"),
354 @ViewDebug.IntToString(from = TYPE_SCREENSHOT,
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800355 to = "TYPE_SCREENSHOT"),
356 @ViewDebug.IntToString(from = TYPE_APPLICATION_OVERLAY,
357 to = "TYPE_APPLICATION_OVERLAY")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700358 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800359 public int type;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700360
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800361 /**
362 * Start of window types that represent normal application windows.
363 */
364 public static final int FIRST_APPLICATION_WINDOW = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700365
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800366 /**
367 * Window type: an application window that serves as the "base" window
368 * of the overall application; all other application windows will
369 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700370 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 */
372 public static final int TYPE_BASE_APPLICATION = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700373
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800374 /**
375 * Window type: a normal application window. The {@link #token} must be
376 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700377 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800378 */
379 public static final int TYPE_APPLICATION = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700380
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 /**
382 * Window type: special application window that is displayed while the
383 * application is starting. Not for use by applications themselves;
384 * this is used by the system to display something until the
385 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700386 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 */
388 public static final int TYPE_APPLICATION_STARTING = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700389
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 /**
Chong Zhangfea963e2016-08-15 17:14:16 -0700391 * Window type: a variation on TYPE_APPLICATION that ensures the window
392 * manager will wait for this window to be drawn before the app is shown.
393 * In multiuser systems shows only on the owning user's window.
394 */
395 public static final int TYPE_DRAWN_APPLICATION = 4;
396
397 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800398 * End of types of application windows.
399 */
400 public static final int LAST_APPLICATION_WINDOW = 99;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700401
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800402 /**
403 * Start of types of sub-windows. The {@link #token} of these windows
404 * must be set to the window they are attached to. These types of
405 * windows are kept next to their attached window in Z-order, and their
406 * coordinate space is relative to their attached window.
407 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700408 public static final int FIRST_SUB_WINDOW = 1000;
409
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800410 /**
411 * Window type: a panel on top of an application window. These windows
412 * appear on top of their attached window.
413 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700414 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
415
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800416 /**
John Spurlock33291d82013-03-13 14:45:14 -0400417 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800418 * are displayed behind their attached window.
419 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700420 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1;
421
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800422 /**
423 * Window type: a sub-panel on top of an application window. These
424 * windows are displayed on top their attached window and any
425 * {@link #TYPE_APPLICATION_PANEL} panels.
426 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700427 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800428
429 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
430 * of the window happens as that of a top-level window, <em>not</em>
431 * as a child of its container.
432 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700433 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3;
434
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800435 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700436 * Window type: window for showing overlays on top of media windows.
437 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
438 * application window. They should be translucent to be useful. This
439 * is a big ugly hack so:
440 * @hide
441 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700442 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4;
443
444 /**
445 * Window type: a above sub-panel on top of an application window and it's
446 * sub-panel windows. These windows are displayed on top of their attached window
447 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels.
Wale Ogunwale3540f932015-06-02 11:07:07 -0700448 * @hide
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700449 */
450 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5;
451
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700452 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800453 * End of types of sub-windows.
454 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700455 public static final int LAST_SUB_WINDOW = 1999;
456
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800457 /**
458 * Start of system-specific window types. These are not normally
459 * created by applications.
460 */
461 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700462
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800463 /**
464 * Window type: the status bar. There can be only one status bar
465 * window; it is placed at the top of the screen, and all other
466 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700467 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800468 */
469 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700470
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800471 /**
472 * Window type: the search bar. There can be only one search bar
473 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700474 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800475 */
476 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700477
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800478 /**
479 * Window type: phone. These are non-application windows providing
480 * user interaction with the phone (in particular incoming calls).
481 * These windows are normally placed above all applications, but behind
482 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700483 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800484 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800485 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800486 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800487 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700488
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800489 /**
490 * Window type: system window, such as low power alert. These windows
491 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700492 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800493 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800495 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100497
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 /**
499 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700500 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200501 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 */
503 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100504
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 /**
506 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700507 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800508 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800509 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800510 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800511 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700512
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 /**
514 * Window type: system overlay windows, which need to be displayed
515 * on top of everything else. These windows must not take input
516 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700517 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800518 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800519 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800520 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800521 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700522
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 /**
524 * Window type: priority phone UI, which needs to be displayed even if
525 * the keyguard is active. These windows must not take input
526 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700527 * In multiuser systems shows on all users' windows.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800528 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800529 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800530 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800531 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700532
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800533 /**
534 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700535 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700538
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800539 /**
540 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700541 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800542 */
543 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700544
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800545 /**
546 * Window type: internal system error windows, appear on top of
547 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700548 * In multiuser systems shows only on the owning user's window.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800549 * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800550 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800551 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700553
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 /**
555 * Window type: internal input methods windows, which appear above
556 * the normal UI. Application windows may be resized or panned to keep
557 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700558 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800559 */
560 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
561
562 /**
563 * Window type: internal input methods dialog windows, which appear above
564 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700565 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800566 */
567 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
568
569 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700570 * Window type: wallpaper window, placed behind any window that wants
571 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700572 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700573 */
574 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
575
576 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800577 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700578 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800579 */
580 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700581
582 /**
583 * Window type: secure system overlay windows, which need to be displayed
584 * on top of everything else. These windows must not take input
585 * focus, or they will interfere with the keyguard.
586 *
587 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
588 * system itself is allowed to create these overlays. Applications cannot
589 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700590 *
591 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700592 * @hide
593 */
594 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
595
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800596 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700597 * Window type: the drag-and-drop pseudowindow. There is only one
598 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700599 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700600 * @hide
601 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700602 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700603
604 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800605 * Window type: panel that slides out from under the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700606 * In multiuser systems shows on all users' windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800607 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800608 */
609 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
610
Jeff Brown83c09682010-12-23 17:50:18 -0800611 /**
612 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700613 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800614 * @hide
615 */
616 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800617
618 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400619 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700620 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400621 * @hide
622 */
623 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
624
625 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700626 * Window type: The volume level overlay/dialog shown when the user
627 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700628 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700629 * @hide
630 */
631 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
632
633 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700634 * Window type: The boot progress dialog, goes on top of everything
635 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700636 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700637 * @hide
638 */
639 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
640
641 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700642 * Window type to consume input events when the systemUI bars are hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700643 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700644 * @hide
645 */
Selim Cinekf83e8242015-05-19 18:08:14 -0700646 public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22;
Dianne Hackborndf89e652011-10-06 22:35:11 -0700647
648 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500649 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700650 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500651 * @hide
652 */
653 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
654
655 /**
Jim Millere898ac52012-04-06 17:10:57 -0700656 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700657 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700658 * @hide
659 */
660 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
661
662 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700663 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700664 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700665 * @hide
666 */
667 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
668
669 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700670 * Window type: Magnification overlay window. Used to highlight the magnified
671 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -0700672 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700673 * @hide
674 */
675 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
676
677 /**
keunyounga446bf02013-06-21 19:07:57 -0700678 * Window type: Window for Presentation on top of private
679 * virtual display.
680 */
681 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
682
683 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700684 * Window type: Windows in the voice interaction layer.
685 * @hide
686 */
687 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
688
689 /**
Phil Weaver40ded282016-01-25 15:49:02 -0800690 * Window type: Windows that are overlaid <em>only</em> by a connected {@link
Svetoslav3a5c7212014-10-14 09:54:26 -0700691 * android.accessibilityservice.AccessibilityService} for interception of
692 * user interactions without changing the windows an accessibility service
693 * can introspect. In particular, an accessibility service can introspect
694 * only windows that a sighted user can interact with which is they can touch
695 * these windows or can type into these windows. For example, if there
696 * is a full screen accessibility overlay that is touchable, the windows
Phil Weaver40ded282016-01-25 15:49:02 -0800697 * below it will be introspectable by an accessibility service even though
Svetoslav3a5c7212014-10-14 09:54:26 -0700698 * they are covered by a touchable window.
699 */
700 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
701
702 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -0700703 * Window type: Starting window for voice interaction layer.
704 * @hide
705 */
706 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
707
708 /**
Filip Gruszczynski466f3212015-09-21 17:57:57 -0700709 * Window for displaying a handle used for resizing docked stacks. This window is owned
710 * by the system process.
711 * @hide
712 */
713 public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34;
714
715 /**
Jason Monk8f7f3182015-11-18 16:35:14 -0500716 * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used
717 * by Quick Settings Tiles.
718 * @hide
719 */
720 public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35;
721
722 /**
Muyuan Li6ca619f2016-03-08 13:30:42 -0800723 * Window type: shares similar characteristics with {@link #TYPE_DREAM}. The layer is
Muyuan Li36ca72c2016-08-06 20:24:06 -0700724 * reserved for screenshot region selection. These windows must not take input focus.
Muyuan Li6ca619f2016-03-08 13:30:42 -0800725 * @hide
726 */
727 public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;
728
729 /**
Wale Ogunwale5b6714c2016-11-01 20:54:46 -0700730 * Window type: Window for Presentation on an external display.
731 * @see android.app.Presentation
732 * @hide
733 */
734 public static final int TYPE_PRESENTATION = FIRST_SYSTEM_WINDOW + 37;
735
736 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800737 * Window type: Application overlay windows are displayed above all activity windows
738 * (types between {@link #FIRST_APPLICATION_WINDOW} and {@link #LAST_APPLICATION_WINDOW})
739 * but below critical system windows like the status bar or IME.
740 * <p>
741 * The system may change the position, size, or visibility of these windows at anytime
742 * to reduce visual clutter to the user and also manage resources.
743 * <p>
744 * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission.
745 * <p>
Wale Ogunwaled993a572017-02-05 13:52:09 -0800746 * The system will adjust the importance of processes with this window type to reduce the
747 * chance of the low-memory-killer killing them.
748 * <p>
749 * In multi-user systems shows only on the owning user's screen.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800750 */
751 public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38;
752
753 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800754 * End of types of system windows.
755 */
756 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800757
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800758 /**
Albert Chaulke4338f82017-04-19 15:54:08 -0400759 * @hide
760 * Used internally when there is no suitable type available.
761 */
762 public static final int INVALID_WINDOW_TYPE = -1;
763
764 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800765 * Return true if the window type is an alert window.
766 *
767 * @param type The window type.
768 * @return If the window type is an alert window.
769 * @hide
770 */
771 public static boolean isSystemAlertWindowType(int type) {
772 switch (type) {
773 case TYPE_PHONE:
774 case TYPE_PRIORITY_PHONE:
775 case TYPE_SYSTEM_ALERT:
776 case TYPE_SYSTEM_ERROR:
777 case TYPE_SYSTEM_OVERLAY:
778 case TYPE_APPLICATION_OVERLAY:
779 return true;
780 }
781 return false;
782 }
783
Mathias Agopiand2112302010-12-07 19:38:17 -0800784 /** @deprecated this is ignored, this value is set automatically when needed. */
785 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800786 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800787 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700788 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800789 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800790 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700791 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800792 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800793 /** @deprecated this is ignored, this value is set automatically when needed. */
794 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800795 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700796
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800797 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700798 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800799 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700800 @Deprecated
801 public int memoryType;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700802
Mike Lockwoodef731622010-01-27 17:51:34 -0500803 /** Window flag: as long as this window is visible to the user, allow
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700804 * the lock screen to activate while the screen is on.
805 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800806 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500807 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
808
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800809 /** Window flag: everything behind this window will be dimmed.
810 * Use {@link #dimAmount} to control the amount of dim. */
811 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700812
813 /** Window flag: blur everything behind this window.
814 * @deprecated Blurring is no longer supported. */
815 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800816 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700817
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800818 /** Window flag: this window won't ever get key input focus, so the
819 * user can not send key or other button events to it. Those will
820 * instead go to whatever focusable window is behind it. This flag
821 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
822 * is explicitly set.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700823 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800824 * <p>Setting this flag also implies that the window will not need to
825 * interact with
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700826 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800827 * independently of any active input method (typically this means it
828 * gets Z-ordered on top of the input method, so it can use the full
829 * screen for its content and cover the input method if needed. You
830 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
831 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700832
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800833 /** Window flag: this window can never receive touch events. */
834 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700835
John Spurlock33291d82013-03-13 14:45:14 -0400836 /** Window flag: even when this window is focusable (its
837 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800838 * outside of the window to be sent to the windows behind it. Otherwise
839 * it will consume all pointer events itself, regardless of whether they
840 * are inside of the window. */
841 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700842
John Spurlock33291d82013-03-13 14:45:14 -0400843 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800844 * screen is pressed, you will receive this first touch event. Usually
845 * the first touch event is consumed by the system since the user can
846 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -0700847 *
848 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800849 */
Jeff Brown037c33e2014-04-09 00:31:55 -0700850 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800851 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700852
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800853 /** Window flag: as long as this window is visible to the user, keep
854 * the device's screen turned on and bright. */
855 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700856
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800857 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -0400858 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800859 * window must correctly position its contents to take the screen
860 * decoration into account. This flag is normally set for you
861 * by Window as described in {@link Window#setFlags}. */
862 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700863
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800864 /** Window flag: allow window to extend outside of the screen. */
865 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700866
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800867 /**
John Spurlock33291d82013-03-13 14:45:14 -0400868 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800869 * this window is displayed. This allows the window to use the entire
870 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -0700871 * an app window with this flag set is on the top layer. A fullscreen window
872 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
873 * {@link #softInputMode} field; the window will stay fullscreen
874 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800875 *
876 * <p>This flag can be controlled in your theme through the
877 * {@link android.R.attr#windowFullscreen} attribute; this attribute
878 * is automatically set for you in the standard fullscreen themes
879 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
880 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
881 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
882 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
883 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
884 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
885 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
886 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 public static final int FLAG_FULLSCREEN = 0x00000400;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700888
John Spurlock33291d82013-03-13 14:45:14 -0400889 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
890 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800891 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700892
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800893 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700894 * the screen.
895 * @deprecated This flag is no longer used. */
896 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800897 public static final int FLAG_DITHER = 0x00001000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700898
John Spurlock33291d82013-03-13 14:45:14 -0400899 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -0700900 * it from appearing in screenshots or from being viewed on non-secure
901 * displays.
902 *
903 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
904 * secure surfaces and secure displays.
905 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800906 public static final int FLAG_SECURE = 0x00002000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700907
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 /** Window flag: a special mode where the layout parameters are used
909 * to perform scaling of the surface when it is composited to the
910 * screen. */
911 public static final int FLAG_SCALED = 0x00004000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700912
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800913 /** Window flag: intended for windows that will often be used when the user is
914 * holding the screen against their face, it will aggressively filter the event
915 * stream to prevent unintended presses in this situation that may not be
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700916 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 * application will receive a CANCEL motion event to indicate this so applications
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700918 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800919 * until the finger is released. */
920 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700921
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800922 /** Window flag: a special option only for use in combination with
923 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
924 * screen your window may appear on top of or behind screen decorations
925 * such as the status bar. By also including this flag, the window
926 * manager will report the inset rectangle needed to ensure your
927 * content is not covered by screen decorations. This flag is normally
928 * set for you by Window as described in {@link Window#setFlags}.*/
929 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700930
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
932 * respect to how this window interacts with the current method. That
933 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
934 * window will behave as if it needs to interact with the input method
935 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
936 * not set and this flag is set, then the window will behave as if it
937 * doesn't need to interact with the input method and can be placed
938 * to use more space and cover the input method.
939 */
940 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700941
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800942 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
943 * can set this flag to receive a single special MotionEvent with
944 * the action
945 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
946 * touches that occur outside of your window. Note that you will not
947 * receive the full down/move/up gesture, only the location of the
948 * first down as an ACTION_OUTSIDE.
949 */
950 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700951
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700952 /** Window flag: special flag to let windows be shown when the screen
953 * is locked. This will let application windows take precedence over
954 * key guard or any other lock screens. Can be used with
955 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700956 * directly before showing the key guard window. Can be used with
957 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
958 * non-secure keyguards. This flag only applies to the top-most
959 * full-screen window.
chaviw59b98852017-06-13 12:05:44 -0700960 * @deprecated Use {@link android.R.attr#showWhenLocked} or
961 * {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an
962 * unintentional double life-cycle event.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700963 */
chaviw59b98852017-06-13 12:05:44 -0700964 @Deprecated
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700965 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
966
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700967 /** Window flag: ask that the system wallpaper be shown behind
968 * your window. The window surface must be translucent to be able
969 * to actually see the wallpaper behind it; this flag just ensures
970 * that the wallpaper surface will be there if this window actually
971 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800972 *
973 * <p>This flag can be controlled in your theme through the
974 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
975 * is automatically set for you in the standard wallpaper themes
976 * such as {@link android.R.style#Theme_Wallpaper},
977 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
978 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
979 * {@link android.R.style#Theme_Holo_Wallpaper},
980 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
981 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
982 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700983 */
984 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700985
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700986 /** Window flag: when set as a window is being added or made
987 * visible, once the window has been shown then the system will
988 * poke the power manager's user activity (as if the user had woken
chaviw59b98852017-06-13 12:05:44 -0700989 * up the device) to turn the screen on.
990 * @deprecated Use {@link android.R.attr#turnScreenOn} or
991 * {@link android.app.Activity#setTurnScreenOn(boolean)} instead to prevent an
992 * unintentional double life-cycle event.
993 */
994 @Deprecated
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700995 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700996
Jeff Sharkey67f9d502017-08-05 13:49:13 -0600997 /**
998 * Window flag: when set the window will cause the keyguard to be
999 * dismissed, only if it is not a secure lock keyguard. Because such a
1000 * keyguard is not needed for security, it will never re-appear if the
1001 * user navigates to another window (in contrast to
1002 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily hide both
1003 * secure and non-secure keyguards but ensure they reappear when the
1004 * user moves to another UI that doesn't hide them). If the keyguard is
1005 * currently active and is secure (requires an unlock credential) than
1006 * the user will still need to confirm it before seeing this window,
1007 * unless {@link #FLAG_SHOW_WHEN_LOCKED} has also been set.
1008 *
1009 * @deprecated Use {@link #FLAG_SHOW_WHEN_LOCKED} or
1010 * {@link KeyguardManager#requestDismissKeyguard} instead.
1011 * Since keyguard was dismissed all the time as long as an
1012 * activity with this flag on its window was focused,
1013 * keyguard couldn't guard against unintentional touches on
1014 * the screen, which isn't desired.
Daniel Sandlerae069f72010-06-17 21:56:26 -04001015 */
Jorim Jaggi07961872016-11-23 11:28:57 +01001016 @Deprecated
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001017 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001018
Jeff Brown01ce2e92010-09-26 22:20:12 -07001019 /** Window flag: when set the window will accept for touch events
1020 * outside of its bounds to be sent to other windows that also
1021 * support split touch. When this flag is not set, the first pointer
1022 * that goes down determines the window to which all subsequent touches
1023 * go until all pointers go up. When this flag is set, each pointer
1024 * (not necessarily the first) that goes down determines the window
1025 * to which all subsequent touches of that pointer will go until that
1026 * pointer goes up thereby enabling touches with multiple pointers
1027 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001028 */
Jeff Brown01ce2e92010-09-26 22:20:12 -07001029 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001030
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001031 /**
Romain Guy72f0a272011-01-09 16:01:46 -08001032 * <p>Indicates whether this window should be hardware accelerated.
1033 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001034 *
Romain Guy72f0a272011-01-09 16:01:46 -08001035 * <p>This flag can be controlled programmatically <em>only</em> to enable
1036 * hardware acceleration. To enable hardware acceleration for a given
1037 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001038 *
Romain Guy72f0a272011-01-09 16:01:46 -08001039 * <pre>
1040 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
1041 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
1042 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
1043 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001044 *
Romain Guy72f0a272011-01-09 16:01:46 -08001045 * <p>It is important to remember that this flag <strong>must</strong>
1046 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001047 *
Romain Guy72f0a272011-01-09 16:01:46 -08001048 * <p>This flag cannot be used to disable hardware acceleration after it
1049 * was enabled in your manifest using
1050 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
1051 * and programmatically disable hardware acceleration (for automated testing
1052 * for instance), make sure it is turned off in your manifest and enable it
1053 * on your activity or dialog when you need it instead, using the method
1054 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -08001055 *
Romain Guy72f0a272011-01-09 16:01:46 -08001056 * <p>This flag is automatically set by the system if the
1057 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
1058 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -08001059 */
1060 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -04001061
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001062 /**
1063 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -08001064 * overscan area, if there is one. The window should still correctly
1065 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001066 *
1067 * <p>This flag can be controlled in your theme through the
1068 * {@link android.R.attr#windowOverscan} attribute; this attribute
1069 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -07001070 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001071 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
1072 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
1073 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
1074 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
1075 *
1076 * <p>When this flag is enabled for a window, its normal content may be obscured
1077 * to some degree by the overscan region of the display. To ensure key parts of
1078 * that content are visible to the user, you can use
1079 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
1080 * to set the point in the view hierarchy where the appropriate offsets should
1081 * be applied. (This can be done either by directly calling this function, using
1082 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
1083 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
1084 * View.fitSystemWindows(Rect)} method).</p>
1085 *
1086 * <p>This mechanism for positioning content elements is identical to its equivalent
1087 * use with layout and {@link View#setSystemUiVisibility(int)
1088 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
1089 * position its UI elements with this overscan flag is set:</p>
1090 *
1091 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -08001092 */
1093 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
1094
John Spurlockbd957402013-10-03 11:38:39 -04001095 /**
1096 * Window flag: request a translucent status bar with minimal system-provided
1097 * background protection.
1098 *
1099 * <p>This flag can be controlled in your theme through the
1100 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
1101 * is automatically set for you in the standard translucent decor themes
1102 * such as
1103 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1104 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1105 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1106 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1107 *
1108 * <p>When this flag is enabled for a window, it automatically sets
1109 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1110 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
1111 */
1112 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
1113
1114 /**
1115 * Window flag: request a translucent navigation bar with minimal system-provided
1116 * background protection.
1117 *
1118 * <p>This flag can be controlled in your theme through the
1119 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
1120 * is automatically set for you in the standard translucent decor themes
1121 * such as
1122 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
1123 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
1124 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
1125 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
1126 *
1127 * <p>When this flag is enabled for a window, it automatically sets
1128 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1129 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
1130 */
1131 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
1132
Adam Lesinski6a591f52013-10-01 18:11:17 -07001133 /**
1134 * Flag for a window in local focus mode.
1135 * Window in local focus mode can control focus independent of window manager using
1136 * {@link Window#setLocalFocus(boolean, boolean)}.
1137 * Usually window in this mode will not get touch/key events from window manager, but will
1138 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
1139 */
1140 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
1141
Jeff Brown98db5fa2011-06-08 15:37:10 -07001142 /** Window flag: Enable touches to slide out of a window into neighboring
1143 * windows in mid-gesture instead of being captured for the duration of
1144 * the gesture.
1145 *
1146 * This flag changes the behavior of touch focus for this window only.
1147 * Touches can slide out of the window but they cannot necessarily slide
1148 * back in (unless the other window with touch focus permits it).
1149 *
1150 * {@hide}
1151 */
Adam Lesinski6a591f52013-10-01 18:11:17 -07001152 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -07001153
Daniel Sandlere02d8082010-10-08 15:13:22 -04001154 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001155 * Window flag: When requesting layout with an attached window, the attached window may
1156 * overlap with the screen decorations of the parent window such as the navigation bar. By
1157 * including this flag, the window manager will layout the attached window within the decor
1158 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -04001159 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001160 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -04001161
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001162 /**
Adrian Roos217ccd22014-05-09 14:29:04 +02001163 * Flag indicating that this Window is responsible for drawing the background for the
1164 * system bars. If set, the system bars are drawn with a transparent background and the
1165 * corresponding areas in this window are filled with the colors specified in
1166 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
1167 */
1168 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
1169
1170 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001171 * Various behavioral options/flags. Default is none.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001172 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001173 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
1174 * @see #FLAG_DIM_BEHIND
1175 * @see #FLAG_NOT_FOCUSABLE
1176 * @see #FLAG_NOT_TOUCHABLE
1177 * @see #FLAG_NOT_TOUCH_MODAL
1178 * @see #FLAG_TOUCHABLE_WHEN_WAKING
1179 * @see #FLAG_KEEP_SCREEN_ON
1180 * @see #FLAG_LAYOUT_IN_SCREEN
1181 * @see #FLAG_LAYOUT_NO_LIMITS
1182 * @see #FLAG_FULLSCREEN
1183 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001184 * @see #FLAG_SECURE
1185 * @see #FLAG_SCALED
1186 * @see #FLAG_IGNORE_CHEEK_PRESSES
1187 * @see #FLAG_LAYOUT_INSET_DECOR
1188 * @see #FLAG_ALT_FOCUSABLE_IM
1189 * @see #FLAG_WATCH_OUTSIDE_TOUCH
1190 * @see #FLAG_SHOW_WHEN_LOCKED
1191 * @see #FLAG_SHOW_WALLPAPER
1192 * @see #FLAG_TURN_SCREEN_ON
1193 * @see #FLAG_DISMISS_KEYGUARD
1194 * @see #FLAG_SPLIT_TOUCH
1195 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -07001196 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +02001197 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001198 */
1199 @ViewDebug.ExportedProperty(flagMapping = {
1200 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
1201 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
1202 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
1203 name = "FLAG_DIM_BEHIND"),
1204 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
1205 name = "FLAG_BLUR_BEHIND"),
1206 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
1207 name = "FLAG_NOT_FOCUSABLE"),
1208 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
1209 name = "FLAG_NOT_TOUCHABLE"),
1210 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
1211 name = "FLAG_NOT_TOUCH_MODAL"),
1212 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
1213 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
1214 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
1215 name = "FLAG_KEEP_SCREEN_ON"),
1216 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
1217 name = "FLAG_LAYOUT_IN_SCREEN"),
1218 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
1219 name = "FLAG_LAYOUT_NO_LIMITS"),
1220 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
1221 name = "FLAG_FULLSCREEN"),
1222 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
1223 name = "FLAG_FORCE_NOT_FULLSCREEN"),
1224 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
1225 name = "FLAG_DITHER"),
1226 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
1227 name = "FLAG_SECURE"),
1228 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
1229 name = "FLAG_SCALED"),
1230 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
1231 name = "FLAG_IGNORE_CHEEK_PRESSES"),
1232 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
1233 name = "FLAG_LAYOUT_INSET_DECOR"),
1234 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
1235 name = "FLAG_ALT_FOCUSABLE_IM"),
1236 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
1237 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
1238 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
1239 name = "FLAG_SHOW_WHEN_LOCKED"),
1240 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
1241 name = "FLAG_SHOW_WALLPAPER"),
1242 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
1243 name = "FLAG_TURN_SCREEN_ON"),
1244 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
1245 name = "FLAG_DISMISS_KEYGUARD"),
1246 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
1247 name = "FLAG_SPLIT_TOUCH"),
1248 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
keunyoung30f420f2013-08-02 14:23:10 -07001249 name = "FLAG_HARDWARE_ACCELERATED"),
1250 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
John Spurlockbd957402013-10-03 11:38:39 -04001251 name = "FLAG_LOCAL_FOCUS_MODE"),
1252 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
1253 name = "FLAG_TRANSLUCENT_STATUS"),
1254 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Adrian Roos217ccd22014-05-09 14:29:04 +02001255 name = "FLAG_TRANSLUCENT_NAVIGATION"),
1256 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
1257 name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001258 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001259 public int flags;
1260
1261 /**
John Reck61375a82014-09-18 19:27:48 +00001262 * If the window has requested hardware acceleration, but this is not
1263 * allowed in the process it is in, then still render it as if it is
1264 * hardware accelerated. This is used for the starting preview windows
1265 * in the system process, which don't need to have the overhead of
1266 * hardware acceleration (they are just a static rendering), but should
1267 * be rendered as such to match the actual window of the app even if it
1268 * is hardware accelerated.
1269 * Even if the window isn't hardware accelerated, still do its rendering
1270 * as if it was.
1271 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1272 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001273 * is generally disabled. This flag must be specified in addition to
John Reck61375a82014-09-18 19:27:48 +00001274 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1275 * windows.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001276 *
John Reck61375a82014-09-18 19:27:48 +00001277 * @hide
1278 */
1279 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1280
1281 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001282 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001283 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001284 * If certain parts of the UI that really do want to use hardware
1285 * acceleration, this flag can be set to force it. This is basically
1286 * for the lock screen. Anyone else using it, you are probably wrong.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001287 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001288 * @hide
1289 */
1290 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1291
1292 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001293 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001294 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001295 * them (they do not affect the wallpaper scrolling operation) by calling
1296 * {@link
1297 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1298 *
1299 * @hide
1300 */
1301 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1302
Craig Mautner88400d32012-09-30 12:35:45 -07001303 /** In a multiuser system if this flag is set and the owner is a system process then this
1304 * window will appear on all user screens. This overrides the default behavior of window
1305 * types that normally only appear on the owning user's screen. Refer to each window type
1306 * to determine its default behavior.
1307 *
1308 * {@hide} */
1309 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1310
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001311 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001312 * Never animate position changes of the window.
1313 *
Robert Carrb48380a2017-04-04 14:56:37 -07001314 * {@hide}
1315 */
1316 @TestApi
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001317 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1318
Adam Lesinski6a591f52013-10-01 18:11:17 -07001319 /** Window flag: special flag to limit the size of the window to be
1320 * original size ([320x480] x density). Used to create window for applications
1321 * running under compatibility mode.
1322 *
1323 * {@hide} */
1324 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1325
1326 /** Window flag: a special option intended for system dialogs. When
1327 * this flag is set, the window will demand focus unconditionally when
1328 * it is created.
1329 * {@hide} */
1330 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1331
John Spurlock3f7cd512013-10-07 12:25:09 -04001332 /** Window flag: maintain the previous translucent decor state when this window
John Spurlockbd957402013-10-03 11:38:39 -04001333 * becomes top-most.
1334 * {@hide} */
1335 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
1336
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001337 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001338 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1339 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1340 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1341 * {@hide}
1342 */
1343 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1344
1345 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001346 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1347 *
1348 * {@hide}
1349 */
1350 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1351
1352 /**
Selim Cinek4a4a2bddc2015-05-07 12:50:19 -07001353 * Flag to force the status bar window to be visible all the time. If the bar is hidden when
1354 * this flag is set it will be shown again and the bar will have a transparent background.
1355 * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1356 *
1357 * {@hide}
1358 */
1359 public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000;
1360
1361 /**
Robert Carr64aadd02015-11-06 13:54:20 -08001362 * Flag indicating that the x, y, width, and height members should be
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001363 * ignored (and thus their previous value preserved). For example
Robert Carr64aadd02015-11-06 13:54:20 -08001364 * because they are being managed externally through repositionChild.
1365 *
1366 * {@hide}
1367 */
1368 public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000;
1369
Filip Gruszczynski1a4dfe52015-11-15 10:58:57 -08001370 /**
1371 * Flag that will make window ignore app visibility and instead depend purely on the decor
1372 * view visibility for determining window visibility. This is used by recents to keep
1373 * drawing after it launches an app.
1374 * @hide
1375 */
1376 public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000;
1377
Robert Carra1eb4392015-12-10 12:43:51 -08001378 /**
1379 * Flag to indicate that this window is not expected to be replaced across
1380 * configuration change triggered activity relaunches. In general the WindowManager
1381 * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces
1382 * until the replacement is ready to show in order to prevent visual glitch. However
1383 * some windows, such as PopupWindows expect to be cleared across configuration change,
1384 * and thus should hint to the WindowManager that it should not wait for a replacement.
1385 * @hide
1386 */
1387 public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000;
Robert Carr64aadd02015-11-06 13:54:20 -08001388
1389 /**
Wale Ogunwale8216eb22015-12-18 10:42:42 -08001390 * Flag to indicate that this child window should always be laid-out in the parent
1391 * frame regardless of the current windowing mode configuration.
1392 * @hide
1393 */
1394 public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000;
1395
1396 /**
Jorim Jaggi8f5701b2016-04-04 18:36:02 -07001397 * Flag to indicate that this window is always drawing the status bar background, no matter
1398 * what the other flags are.
1399 * @hide
1400 */
1401 public static final int PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND = 0x00020000;
1402
1403 /**
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001404 * Flag to indicate that this window needs Sustained Performance Mode if
1405 * the device supports it.
1406 * @hide
1407 */
John Reck60e885f2016-04-21 15:40:45 -07001408 public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000;
Ruchi Kandoi43e38de2016-04-14 19:34:53 -07001409
1410 /**
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001411 * Flag to indicate that any window added by an application process that is of type
1412 * {@link #TYPE_TOAST} or that requires
1413 * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when
1414 * this window is visible.
Jorim Jaggi02886a82016-12-06 09:10:06 -08001415 * @hide
1416 */
Wale Ogunwale01ad4342017-06-30 07:07:01 -07001417 @RequiresPermission(android.Manifest.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
1418 public static final int PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000;
Jorim Jaggi02886a82016-12-06 09:10:06 -08001419
1420 /**
Robert Carr132c9f52017-07-31 17:02:30 -07001421 * Indicates that this window is the rounded corners overlay present on some
1422 * devices this means that it will be excluded from: screenshots,
1423 * screen magnification, and mirroring.
Phil Weaverd321075e2017-06-13 09:13:35 -07001424 * @hide
1425 */
Robert Carr132c9f52017-07-31 17:02:30 -07001426 public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000;
Phil Weaverd321075e2017-06-13 09:13:35 -07001427
1428 /**
Jorim Jaggif12ec0f2017-08-23 16:14:10 +02001429 * If this flag is set on the window, window manager will acquire a sleep token that puts
1430 * all activities to sleep as long as this window is visible. When this flag is set, the
1431 * window needs to occlude all activity windows.
1432 * @hide
1433 */
1434 @RequiresPermission(permission.DEVICE_POWER)
1435 public static final int PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN = 0x00200000;
1436
1437 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001438 * Control flags that are private to the platform.
1439 * @hide
1440 */
Robert Carrb48380a2017-04-04 14:56:37 -07001441 @TestApi
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001442 public int privateFlags;
1443
1444 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001445 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1446 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1447 * key. For this case, we should look at windows behind it to determine the appropriate
1448 * value.
1449 *
1450 * @hide
1451 */
1452 public static final int NEEDS_MENU_UNSET = 0;
1453
1454 /**
1455 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1456 * menu key.
1457 *
1458 * @hide
1459 */
1460 public static final int NEEDS_MENU_SET_TRUE = 1;
1461
1462 /**
1463 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1464 * needs a menu key.
1465 *
1466 * @hide
1467 */
1468 public static final int NEEDS_MENU_SET_FALSE = 2;
1469
1470 /**
1471 * State variable for a window belonging to an activity that responds to
1472 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1473 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1474 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1475 *
1476 * (Note that Action Bars, when available, are the preferred way to offer additional
1477 * functions otherwise accessed via an options menu.)
1478 *
1479 * {@hide}
1480 */
1481 public int needsMenuKey = NEEDS_MENU_UNSET;
1482
1483 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001484 * Given a particular set of window manager flags, determine whether
1485 * such a window may be a target for an input method when it has
1486 * focus. In particular, this checks the
1487 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1488 * flags and returns true if the combination of the two corresponds
1489 * to a window that needs to be behind the input method so that the
1490 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001491 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001492 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001493 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001494 * @return Returns true if such a window should be behind/interact
1495 * with an input method, false if not.
1496 */
1497 public static boolean mayUseInputMethod(int flags) {
1498 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
1499 case 0:
1500 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
1501 return true;
1502 }
1503 return false;
1504 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001505
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001506 /**
1507 * Mask for {@link #softInputMode} of the bits that determine the
1508 * desired visibility state of the soft input area for this window.
1509 */
1510 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001511
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001512 /**
1513 * Visibility state for {@link #softInputMode}: no state has been specified.
1514 */
1515 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001516
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001517 /**
1518 * Visibility state for {@link #softInputMode}: please don't change the state of
1519 * the soft input area.
1520 */
1521 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001522
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001523 /**
1524 * Visibility state for {@link #softInputMode}: please hide any soft input
1525 * area when normally appropriate (when the user is navigating
1526 * forward to your window).
1527 */
1528 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001529
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001530 /**
1531 * Visibility state for {@link #softInputMode}: please always hide any
1532 * soft input area when this window receives focus.
1533 */
1534 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001535
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001536 /**
1537 * Visibility state for {@link #softInputMode}: please show the soft
1538 * input area when normally appropriate (when the user is navigating
1539 * forward to your window).
1540 */
1541 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001542
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001543 /**
1544 * Visibility state for {@link #softInputMode}: please always make the
1545 * soft input area visible when this window receives input focus.
1546 */
1547 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001548
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001549 /**
1550 * Mask for {@link #softInputMode} of the bits that determine the
1551 * way that the window should be adjusted to accommodate the soft
1552 * input window.
1553 */
1554 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001555
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001556 /** Adjustment option for {@link #softInputMode}: nothing specified.
1557 * The system will try to pick one or
1558 * the other depending on the contents of the window.
1559 */
1560 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001561
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001562 /** Adjustment option for {@link #softInputMode}: set to allow the
1563 * window to be resized when an input
1564 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07001565 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001566 * {@link #SOFT_INPUT_ADJUST_PAN}; if
1567 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07001568 * the other depending on the contents of the window. If the window's
1569 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
1570 * value for {@link #softInputMode} will be ignored; the window will
1571 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001572 */
1573 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001575 /** Adjustment option for {@link #softInputMode}: set to have a window
1576 * pan when an input method is
1577 * shown, so it doesn't need to deal with resizing but just panned
1578 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07001579 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001580 * neither of these are set, then the system will try to pick one or
1581 * the other depending on the contents of the window.
1582 */
1583 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001584
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001585 /** Adjustment option for {@link #softInputMode}: set to have a window
1586 * not adjust for a shown input method. The window will not be resized,
1587 * and it will not be panned to make its focus visible.
1588 */
1589 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
1590
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001591 /**
1592 * Bit for {@link #softInputMode}: set when the user has navigated
1593 * forward to the window. This is normally set automatically for
1594 * you by the system, though you may want to set it in certain cases
1595 * when you are displaying a window yourself. This flag will always
1596 * be cleared automatically after the window is displayed.
1597 */
1598 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001599
1600 /**
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001601 * An internal annotation for flags that can be specified to {@link #softInputMode}.
1602 *
1603 * @hide
1604 */
1605 @Retention(RetentionPolicy.SOURCE)
1606 @IntDef(flag = true, value = {
1607 SOFT_INPUT_STATE_UNSPECIFIED,
1608 SOFT_INPUT_STATE_UNCHANGED,
1609 SOFT_INPUT_STATE_HIDDEN,
1610 SOFT_INPUT_STATE_ALWAYS_HIDDEN,
1611 SOFT_INPUT_STATE_VISIBLE,
1612 SOFT_INPUT_STATE_ALWAYS_VISIBLE,
1613 SOFT_INPUT_ADJUST_UNSPECIFIED,
1614 SOFT_INPUT_ADJUST_RESIZE,
1615 SOFT_INPUT_ADJUST_PAN,
1616 SOFT_INPUT_ADJUST_NOTHING,
1617 SOFT_INPUT_IS_FORWARD_NAVIGATION,
1618 })
1619 public @interface SoftInputModeFlags {}
1620
1621 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08001622 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001623 * of:
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001624 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001625 * <ul>
1626 * <li> One of the visibility states
1627 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001628 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_HIDDEN},
1629 * {@link #SOFT_INPUT_STATE_VISIBLE}, or {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001630 * <li> One of the adjustment options
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001631 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, {@link #SOFT_INPUT_ADJUST_RESIZE},
1632 * {@link #SOFT_INPUT_ADJUST_PAN}, or {@link #SOFT_INPUT_ADJUST_NOTHING}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001633 * </ul>
1634 *
1635 *
1636 * <p>This flag can be controlled in your theme through the
1637 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001638 */
Yohei Yukawa22dac1c2017-02-12 16:54:16 -08001639 @SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001640 public int softInputMode;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001641
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001642 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001643 * Placement of window within the screen as per {@link Gravity}. Both
1644 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1645 * android.graphics.Rect) Gravity.apply} and
1646 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1647 * Gravity.applyDisplay} are used during window layout, with this value
1648 * given as the desired gravity. For example you can specify
1649 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
1650 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
1651 * to control the behavior of
1652 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1653 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001654 *
1655 * @see Gravity
1656 */
1657 public int gravity;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001658
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001659 /**
1660 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001661 * between the container and the widget. See
1662 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1663 * android.graphics.Rect) Gravity.apply} for how this is used. This
1664 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001665 */
1666 public float horizontalMargin;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001667
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001668 /**
1669 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001670 * between the container and the widget. See
1671 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1672 * android.graphics.Rect) Gravity.apply} for how this is used. This
1673 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001674 */
1675 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001676
1677 /**
1678 * Positive insets between the drawing surface and window content.
1679 *
1680 * @hide
1681 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07001682 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08001683
1684 /**
1685 * Whether the surface insets have been manually set. When set to
1686 * {@code false}, the view root will automatically determine the
1687 * appropriate surface insets.
1688 *
1689 * @see #surfaceInsets
1690 * @hide
1691 */
1692 public boolean hasManualSurfaceInsets;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001694 /**
Wale Ogunwale246c2092016-04-07 14:12:44 -07001695 * Whether the previous surface insets should be used vs. what is currently set. When set
1696 * to {@code true}, the view root will ignore surfaces insets in this object and use what
1697 * it currently has.
1698 *
1699 * @see #surfaceInsets
1700 * @hide
1701 */
1702 public boolean preservePreviousSurfaceInsets = true;
1703
1704 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001705 * The desired bitmap format. May be one of the constants in
Romain Guy48327452017-01-23 17:03:35 -08001706 * {@link android.graphics.PixelFormat}. The choice of format
1707 * might be overridden by {@link #setColorMode(int)}. Default is OPAQUE.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001708 */
1709 public int format;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001710
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001711 /**
1712 * A style resource defining the animations to use for this window.
1713 * This must be a system resource; it can not be an application resource
1714 * because the window manager does not have access to applications.
1715 */
1716 public int windowAnimations;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001717
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001718 /**
1719 * An alpha value to apply to this entire window.
1720 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1721 */
1722 public float alpha = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001723
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001724 /**
1725 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1726 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1727 * dim.
1728 */
1729 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001730
1731 /**
1732 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1733 * indicating that the brightness value is not overridden for this window
1734 * and normal brightness policy should be used.
1735 */
1736 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1737
1738 /**
1739 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1740 * indicating that the screen or button backlight brightness should be set
1741 * to the lowest value when this window is in front.
1742 */
1743 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1744
1745 /**
1746 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1747 * indicating that the screen or button backlight brightness should be set
1748 * to the hightest value when this window is in front.
1749 */
1750 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001751
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001752 /**
1753 * This can be used to override the user's preferred brightness of
1754 * the screen. A value of less than 0, the default, means to use the
1755 * preferred screen brightness. 0 to 1 adjusts the brightness from
1756 * dark to full bright.
1757 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001758 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001759
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001760 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001761 * This can be used to override the standard behavior of the button and
1762 * keyboard backlights. A value of less than 0, the default, means to
1763 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1764 * from dark to full bright.
1765 */
1766 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1767
1768 /**
Robert Carr427ba4f2017-07-17 18:37:06 -07001769 * Unspecified value for {@link #rotationAnimation} indicating
1770 * a lack of preference.
1771 * @hide
1772 */
1773 public static final int ROTATION_ANIMATION_UNSPECIFIED = -1;
1774
1775 /**
Robert Carr652aae42016-10-17 16:48:14 -07001776 * Value for {@link #rotationAnimation} which specifies that this
1777 * window will visually rotate in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08001778 */
1779 public static final int ROTATION_ANIMATION_ROTATE = 0;
1780
1781 /**
Robert Carr652aae42016-10-17 16:48:14 -07001782 * Value for {@link #rotationAnimation} which specifies that this
1783 * window will fade in or out following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08001784 */
1785 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
1786
1787 /**
Robert Carr652aae42016-10-17 16:48:14 -07001788 * Value for {@link #rotationAnimation} which specifies that this window
1789 * will immediately disappear or appear following a rotation.
Craig Mautner3c174372013-02-21 17:54:37 -08001790 */
1791 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
1792
1793 /**
Robert Carr57d9fbd2016-08-15 12:00:35 -07001794 * Value for {@link #rotationAnimation} to specify seamless rotation mode.
1795 * This works like JUMPCUT but will fall back to CROSSFADE if rotation
Robert Carr652aae42016-10-17 16:48:14 -07001796 * can't be applied without pausing the screen. For example, this is ideal
1797 * for Camera apps which don't want the viewfinder contents to ever rotate
1798 * or fade (and rather to be seamless) but also don't want ROTATION_ANIMATION_JUMPCUT
1799 * during app transition scenarios where seamless rotation can't be applied.
Robert Carr57d9fbd2016-08-15 12:00:35 -07001800 */
1801 public static final int ROTATION_ANIMATION_SEAMLESS = 3;
1802
1803 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001804 * Define the exit and entry animations used on this window when the device is rotated.
1805 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08001806 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001807 * by other windows. All other situations default to the
1808 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001809 *
Craig Mautner3c174372013-02-21 17:54:37 -08001810 * @see #ROTATION_ANIMATION_ROTATE
1811 * @see #ROTATION_ANIMATION_CROSSFADE
1812 * @see #ROTATION_ANIMATION_JUMPCUT
1813 */
1814 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
1815
1816 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001817 * Identifier for this window. This will usually be filled in for
1818 * you.
1819 */
1820 public IBinder token = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001821
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001822 /**
1823 * Name of the package owning this window.
1824 */
1825 public String packageName = null;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001826
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001827 /**
1828 * Specific orientation value for a window.
1829 * May be any of the same values allowed
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001830 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1831 * If not set, a default value of
1832 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001833 * will be used.
1834 */
1835 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001836
1837 /**
Michael Wright3f145a22014-07-22 19:46:03 -07001838 * The preferred refresh rate for the window.
1839 *
1840 * This must be one of the supported refresh rates obtained for the display(s) the window
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001841 * is on. The selected refresh rate will be applied to the display's default mode.
1842 *
1843 * This value is ignored if {@link #preferredDisplayModeId} is set.
Michael Wright3f145a22014-07-22 19:46:03 -07001844 *
1845 * @see Display#getSupportedRefreshRates()
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001846 * @deprecated use {@link #preferredDisplayModeId} instead
Michael Wright3f145a22014-07-22 19:46:03 -07001847 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001848 @Deprecated
Michael Wright3f145a22014-07-22 19:46:03 -07001849 public float preferredRefreshRate;
1850
1851 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001852 * Id of the preferred display mode for the window.
1853 * <p>
1854 * This must be one of the supported modes obtained for the display(s) the window is on.
1855 * A value of {@code 0} means no preference.
1856 *
1857 * @see Display#getSupportedModes()
1858 * @see Display.Mode#getModeId()
1859 */
1860 public int preferredDisplayModeId;
1861
1862 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001863 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001864 *
1865 * @see View#STATUS_BAR_VISIBLE
1866 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001867 */
1868 public int systemUiVisibility;
1869
1870 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001871 * @hide
1872 * The ui visibility as requested by the views in this hierarchy.
1873 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1874 */
1875 public int subtreeSystemUiVisibility;
1876
1877 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001878 * Get callbacks about the system ui visibility changing.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001879 *
Joe Onorato664644d2011-01-23 17:53:23 -08001880 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1881 *
1882 * @hide
1883 */
1884 public boolean hasSystemUiListeners;
1885
Jeff Brown474dcb52011-06-14 20:22:50 -07001886 /**
1887 * When this window has focus, disable touch pad pointer gesture processing.
1888 * The window will receive raw position updates from the touch pad instead
1889 * of pointer movements and synthetic touch events.
1890 *
1891 * @hide
1892 */
1893 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1894
1895 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001896 * Does not construct an input channel for this window. The channel will therefore
1897 * be incapable of receiving input.
1898 *
1899 * @hide
1900 */
1901 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1902
1903 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001904 * When this window has focus, does not call user activity for all input events so
1905 * the application will have to do it itself. Should only be used by
1906 * the keyguard and phone app.
1907 * <p>
1908 * Should only be used by the keyguard and phone app.
1909 * </p>
1910 *
1911 * @hide
1912 */
1913 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
1914
1915 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001916 * Control special features of the input subsystem.
1917 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001918 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001919 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001920 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07001921 * @hide
1922 */
1923 public int inputFeatures;
1924
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001925 /**
1926 * Sets the number of milliseconds before the user activity timeout occurs
1927 * when this window has focus. A value of -1 uses the standard timeout.
1928 * A value of 0 uses the minimum support display timeout.
1929 * <p>
1930 * This property can only be used to reduce the user specified display timeout;
1931 * it can never make the timeout longer than it normally would be.
1932 * </p><p>
1933 * Should only be used by the keyguard and phone app.
1934 * </p>
1935 *
1936 * @hide
1937 */
1938 public long userActivityTimeout = -1;
1939
Phil Weaver396d5492016-03-22 17:53:50 -07001940 /**
1941 * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the
1942 * window.
1943 *
1944 * @hide
1945 */
1946 public int accessibilityIdOfAnchor = -1;
1947
Phil Weaver9be3c7b2016-04-07 15:15:41 -07001948 /**
1949 * The window title isn't kept in sync with what is displayed in the title bar, so we
1950 * separately track the currently shown title to provide to accessibility.
1951 *
1952 * @hide
1953 */
Alan Viverette39259dd2017-05-25 11:10:46 -04001954 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07001955 public CharSequence accessibilityTitle;
1956
Robert Carr70f0d222016-04-10 16:33:08 -07001957 /**
Svetoslav Ganovaa076532016-08-01 19:16:43 -07001958 * Sets a timeout in milliseconds before which the window will be hidden
Robert Carr70f0d222016-04-10 16:33:08 -07001959 * by the window manager. Useful for transient notifications like toasts
1960 * so we don't have to rely on client cooperation to ensure the window
Svetoslav Ganovaa076532016-08-01 19:16:43 -07001961 * is hidden. Must be specified at window creation time. Note that apps
1962 * are not prepared to handle their windows being removed without their
1963 * explicit request and may try to interact with the removed window
1964 * resulting in undefined behavior and crashes. Therefore, we do hide
1965 * such windows to prevent them from overlaying other apps.
Robert Carr70f0d222016-04-10 16:33:08 -07001966 *
1967 * @hide
1968 */
Svetoslav Ganovaa076532016-08-01 19:16:43 -07001969 public long hideTimeoutMilliseconds = -1;
Robert Carr70f0d222016-04-10 16:33:08 -07001970
Romain Guy48327452017-01-23 17:03:35 -08001971 /**
1972 * The color mode requested by this window. The target display may
1973 * not be able to honor the request. When the color mode is not set
1974 * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the
1975 * pixel format specified in {@link #format}.
1976 *
1977 * @hide
1978 */
1979 @ActivityInfo.ColorMode
1980 private int mColorMode = ActivityInfo.COLOR_MODE_DEFAULT;
1981
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001982 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001983 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001984 type = TYPE_APPLICATION;
1985 format = PixelFormat.OPAQUE;
1986 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001987
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001988 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001989 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001990 type = _type;
1991 format = PixelFormat.OPAQUE;
1992 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07001993
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001994 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001995 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001996 type = _type;
1997 flags = _flags;
1998 format = PixelFormat.OPAQUE;
1999 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002000
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002001 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08002002 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002003 type = _type;
2004 flags = _flags;
2005 format = _format;
2006 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002007
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002008 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
2009 super(w, h);
2010 type = _type;
2011 flags = _flags;
2012 format = _format;
2013 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002014
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002015 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
2016 int _flags, int _format) {
2017 super(w, h);
2018 x = xpos;
2019 y = ypos;
2020 type = _type;
2021 flags = _flags;
2022 format = _format;
2023 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002024
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002025 public final void setTitle(CharSequence title) {
2026 if (null == title)
2027 title = "";
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002028
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002029 mTitle = TextUtils.stringOrSpannedString(title);
2030 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002031
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002032 public final CharSequence getTitle() {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002033 return mTitle != null ? mTitle : "";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002034 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002035
Wale Ogunwale246c2092016-04-07 14:12:44 -07002036 /**
2037 * Sets the surface insets based on the elevation (visual z position) of the input view.
2038 * @hide
2039 */
2040 public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) {
2041 final int surfaceInset = (int) Math.ceil(view.getZ() * 2);
Vladislav Kaznacheevcb4bbd72016-05-12 12:56:31 -07002042 // Partial workaround for b/28318973. Every inset change causes a freeform window
2043 // to jump a little for a few frames. If we never allow surface insets to decrease,
2044 // they will stabilize quickly (often from the very beginning, as most windows start
2045 // as focused).
2046 // TODO(b/22668382) to fix this properly.
2047 if (surfaceInset == 0) {
2048 // OK to have 0 (this is the case for non-freeform windows).
2049 surfaceInsets.set(0, 0, 0, 0);
2050 } else {
2051 surfaceInsets.set(
2052 Math.max(surfaceInset, surfaceInsets.left),
2053 Math.max(surfaceInset, surfaceInsets.top),
2054 Math.max(surfaceInset, surfaceInsets.right),
2055 Math.max(surfaceInset, surfaceInsets.bottom));
2056 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07002057 hasManualSurfaceInsets = manual;
2058 preservePreviousSurfaceInsets = preservePrevious;
2059 }
2060
Romain Guy48327452017-01-23 17:03:35 -08002061 /**
2062 * <p>Set the color mode of the window. Setting the color mode might
2063 * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
2064 *
2065 * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2066 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or
2067 * {@link ActivityInfo#COLOR_MODE_HDR}.</p>
2068 *
2069 * @see #getColorMode()
2070 */
2071 public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
2072 mColorMode = colorMode;
2073 }
2074
2075 /**
2076 * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
2077 * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.
2078 *
2079 * @see #setColorMode(int)
2080 */
2081 @ActivityInfo.ColorMode
2082 public int getColorMode() {
2083 return mColorMode;
2084 }
2085
Bryce Lee53b9fbd2015-02-06 12:06:34 -08002086 /** @hide */
2087 @SystemApi
2088 public final void setUserActivityTimeout(long timeout) {
2089 userActivityTimeout = timeout;
2090 }
2091
2092 /** @hide */
2093 @SystemApi
2094 public final long getUserActivityTimeout() {
2095 return userActivityTimeout;
2096 }
2097
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002098 public int describeContents() {
2099 return 0;
2100 }
2101
2102 public void writeToParcel(Parcel out, int parcelableFlags) {
2103 out.writeInt(width);
2104 out.writeInt(height);
2105 out.writeInt(x);
2106 out.writeInt(y);
2107 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002108 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002109 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002110 out.writeInt(softInputMode);
2111 out.writeInt(gravity);
2112 out.writeFloat(horizontalMargin);
2113 out.writeFloat(verticalMargin);
2114 out.writeInt(format);
2115 out.writeInt(windowAnimations);
2116 out.writeFloat(alpha);
2117 out.writeFloat(dimAmount);
2118 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002119 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08002120 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002121 out.writeStrongBinder(token);
2122 out.writeString(packageName);
2123 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
2124 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07002125 out.writeFloat(preferredRefreshRate);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002126 out.writeInt(preferredDisplayModeId);
Joe Onorato664644d2011-01-23 17:53:23 -08002127 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08002128 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08002129 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07002130 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002131 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07002132 out.writeInt(surfaceInsets.left);
2133 out.writeInt(surfaceInsets.top);
2134 out.writeInt(surfaceInsets.right);
2135 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08002136 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale246c2092016-04-07 14:12:44 -07002137 out.writeInt(preservePreviousSurfaceInsets ? 1 : 0);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002138 out.writeInt(needsMenuKey);
Phil Weaver396d5492016-03-22 17:53:50 -07002139 out.writeInt(accessibilityIdOfAnchor);
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002140 TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags);
Romain Guy26a2b972017-04-17 09:39:51 -07002141 out.writeInt(mColorMode);
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002142 out.writeLong(hideTimeoutMilliseconds);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002143 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002144
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002145 public static final Parcelable.Creator<LayoutParams> CREATOR
2146 = new Parcelable.Creator<LayoutParams>() {
2147 public LayoutParams createFromParcel(Parcel in) {
2148 return new LayoutParams(in);
2149 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002150
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002151 public LayoutParams[] newArray(int size) {
2152 return new LayoutParams[size];
2153 }
2154 };
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002155
2156
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002157 public LayoutParams(Parcel in) {
2158 width = in.readInt();
2159 height = in.readInt();
2160 x = in.readInt();
2161 y = in.readInt();
2162 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002163 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002164 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002165 softInputMode = in.readInt();
2166 gravity = in.readInt();
2167 horizontalMargin = in.readFloat();
2168 verticalMargin = in.readFloat();
2169 format = in.readInt();
2170 windowAnimations = in.readInt();
2171 alpha = in.readFloat();
2172 dimAmount = in.readFloat();
2173 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002174 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08002175 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002176 token = in.readStrongBinder();
2177 packageName = in.readString();
2178 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
2179 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07002180 preferredRefreshRate = in.readFloat();
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002181 preferredDisplayModeId = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002182 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08002183 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08002184 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07002185 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002186 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07002187 surfaceInsets.left = in.readInt();
2188 surfaceInsets.top = in.readInt();
2189 surfaceInsets.right = in.readInt();
2190 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08002191 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale246c2092016-04-07 14:12:44 -07002192 preservePreviousSurfaceInsets = in.readInt() != 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002193 needsMenuKey = in.readInt();
Phil Weaver396d5492016-03-22 17:53:50 -07002194 accessibilityIdOfAnchor = in.readInt();
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002195 accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
Romain Guy26a2b972017-04-17 09:39:51 -07002196 mColorMode = in.readInt();
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002197 hideTimeoutMilliseconds = in.readLong();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002198 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002199
Romain Guy72998072009-06-22 11:09:20 -07002200 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002201 public static final int LAYOUT_CHANGED = 1<<0;
2202 public static final int TYPE_CHANGED = 1<<1;
2203 public static final int FLAGS_CHANGED = 1<<2;
2204 public static final int FORMAT_CHANGED = 1<<3;
2205 public static final int ANIMATION_CHANGED = 1<<4;
2206 public static final int DIM_AMOUNT_CHANGED = 1<<5;
2207 public static final int TITLE_CHANGED = 1<<6;
2208 public static final int ALPHA_CHANGED = 1<<7;
2209 public static final int MEMORY_TYPE_CHANGED = 1<<8;
2210 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
2211 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
2212 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08002213 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002214 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002215 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08002216 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002217 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08002218 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002219 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07002220 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002221 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002222 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002223 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07002224 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08002225 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002226 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04002227 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
2228 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07002229 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002230 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07002231 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
2232 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002233 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
2234 /** {@hide} */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002235 public static final int PREFERRED_DISPLAY_MODE_ID = 1 << 23;
2236 /** {@hide} */
Phil Weaver396d5492016-03-22 17:53:50 -07002237 public static final int ACCESSIBILITY_ANCHOR_CHANGED = 1 << 24;
2238 /** {@hide} */
Alan Viverette39259dd2017-05-25 11:10:46 -04002239 @TestApi
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002240 public static final int ACCESSIBILITY_TITLE_CHANGED = 1 << 25;
2241 /** {@hide} */
Romain Guy26a2b972017-04-17 09:39:51 -07002242 public static final int COLOR_MODE_CHANGED = 1 << 26;
2243 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07002244 public static final int EVERYTHING_CHANGED = 0xffffffff;
2245
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002246 // internal buffer to backup/restore parameters under compatibility mode.
2247 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002249 public final int copyFrom(LayoutParams o) {
2250 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002251
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002252 if (width != o.width) {
2253 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07002254 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002255 }
2256 if (height != o.height) {
2257 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07002258 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002259 }
2260 if (x != o.x) {
2261 x = o.x;
2262 changes |= LAYOUT_CHANGED;
2263 }
2264 if (y != o.y) {
2265 y = o.y;
2266 changes |= LAYOUT_CHANGED;
2267 }
2268 if (horizontalWeight != o.horizontalWeight) {
2269 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002270 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002271 }
2272 if (verticalWeight != o.verticalWeight) {
2273 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07002274 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002275 }
2276 if (horizontalMargin != o.horizontalMargin) {
2277 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002278 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002279 }
2280 if (verticalMargin != o.verticalMargin) {
2281 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07002282 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002283 }
2284 if (type != o.type) {
2285 type = o.type;
2286 changes |= TYPE_CHANGED;
2287 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002288 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04002289 final int diff = flags ^ o.flags;
2290 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
2291 changes |= TRANSLUCENT_FLAGS_CHANGED;
2292 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002293 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07002294 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002295 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002296 if (privateFlags != o.privateFlags) {
2297 privateFlags = o.privateFlags;
2298 changes |= PRIVATE_FLAGS_CHANGED;
2299 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002300 if (softInputMode != o.softInputMode) {
2301 softInputMode = o.softInputMode;
2302 changes |= SOFT_INPUT_MODE_CHANGED;
2303 }
2304 if (gravity != o.gravity) {
2305 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07002306 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002308 if (format != o.format) {
2309 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07002310 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002311 }
2312 if (windowAnimations != o.windowAnimations) {
2313 windowAnimations = o.windowAnimations;
2314 changes |= ANIMATION_CHANGED;
2315 }
2316 if (token == null) {
2317 // NOTE: token only copied if the recipient doesn't
2318 // already have one.
2319 token = o.token;
2320 }
2321 if (packageName == null) {
2322 // NOTE: packageName only copied if the recipient doesn't
2323 // already have one.
2324 packageName = o.packageName;
2325 }
Wale Ogunwale1f240c92016-02-22 18:04:58 -08002326 if (!Objects.equals(mTitle, o.mTitle) && o.mTitle != null) {
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002327 // NOTE: mTitle only copied if the originator set one.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002328 mTitle = o.mTitle;
2329 changes |= TITLE_CHANGED;
2330 }
2331 if (alpha != o.alpha) {
2332 alpha = o.alpha;
2333 changes |= ALPHA_CHANGED;
2334 }
2335 if (dimAmount != o.dimAmount) {
2336 dimAmount = o.dimAmount;
2337 changes |= DIM_AMOUNT_CHANGED;
2338 }
2339 if (screenBrightness != o.screenBrightness) {
2340 screenBrightness = o.screenBrightness;
2341 changes |= SCREEN_BRIGHTNESS_CHANGED;
2342 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05002343 if (buttonBrightness != o.buttonBrightness) {
2344 buttonBrightness = o.buttonBrightness;
2345 changes |= BUTTON_BRIGHTNESS_CHANGED;
2346 }
Craig Mautner3c174372013-02-21 17:54:37 -08002347 if (rotationAnimation != o.rotationAnimation) {
2348 rotationAnimation = o.rotationAnimation;
2349 changes |= ROTATION_ANIMATION_CHANGED;
2350 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002351
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002352 if (screenOrientation != o.screenOrientation) {
2353 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07002354 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002355 }
Romain Guy529b60a2010-08-03 18:05:47 -07002356
Michael Wright3f145a22014-07-22 19:46:03 -07002357 if (preferredRefreshRate != o.preferredRefreshRate) {
2358 preferredRefreshRate = o.preferredRefreshRate;
2359 changes |= PREFERRED_REFRESH_RATE_CHANGED;
2360 }
2361
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002362 if (preferredDisplayModeId != o.preferredDisplayModeId) {
2363 preferredDisplayModeId = o.preferredDisplayModeId;
2364 changes |= PREFERRED_DISPLAY_MODE_ID;
2365 }
2366
Joe Onorato14782f72011-01-25 19:53:17 -08002367 if (systemUiVisibility != o.systemUiVisibility
2368 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08002369 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08002370 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08002371 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
2372 }
2373
2374 if (hasSystemUiListeners != o.hasSystemUiListeners) {
2375 hasSystemUiListeners = o.hasSystemUiListeners;
2376 changes |= SYSTEM_UI_LISTENER_CHANGED;
2377 }
2378
Jeff Brown474dcb52011-06-14 20:22:50 -07002379 if (inputFeatures != o.inputFeatures) {
2380 inputFeatures = o.inputFeatures;
2381 changes |= INPUT_FEATURES_CHANGED;
2382 }
2383
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002384 if (userActivityTimeout != o.userActivityTimeout) {
2385 userActivityTimeout = o.userActivityTimeout;
2386 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
2387 }
2388
Alan Viverette49a22e82014-07-12 20:01:27 -07002389 if (!surfaceInsets.equals(o.surfaceInsets)) {
2390 surfaceInsets.set(o.surfaceInsets);
2391 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07002392 }
2393
Alan Viverette5435a302015-01-29 10:25:34 -08002394 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
2395 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
2396 changes |= SURFACE_INSETS_CHANGED;
2397 }
2398
Wale Ogunwale246c2092016-04-07 14:12:44 -07002399 if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) {
2400 preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets;
2401 changes |= SURFACE_INSETS_CHANGED;
2402 }
2403
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002404 if (needsMenuKey != o.needsMenuKey) {
2405 needsMenuKey = o.needsMenuKey;
2406 changes |= NEEDS_MENU_KEY_CHANGED;
2407 }
2408
Phil Weaver396d5492016-03-22 17:53:50 -07002409 if (accessibilityIdOfAnchor != o.accessibilityIdOfAnchor) {
2410 accessibilityIdOfAnchor = o.accessibilityIdOfAnchor;
2411 changes |= ACCESSIBILITY_ANCHOR_CHANGED;
2412 }
2413
Phil Weaver9be3c7b2016-04-07 15:15:41 -07002414 if (!Objects.equals(accessibilityTitle, o.accessibilityTitle)
2415 && o.accessibilityTitle != null) {
2416 // NOTE: accessibilityTitle only copied if the originator set one.
2417 accessibilityTitle = o.accessibilityTitle;
2418 changes |= ACCESSIBILITY_TITLE_CHANGED;
2419 }
2420
Romain Guy26a2b972017-04-17 09:39:51 -07002421 if (mColorMode != o.mColorMode) {
2422 mColorMode = o.mColorMode;
2423 changes |= COLOR_MODE_CHANGED;
2424 }
2425
Robert Carr70f0d222016-04-10 16:33:08 -07002426 // This can't change, it's only set at window creation time.
Svetoslav Ganovaa076532016-08-01 19:16:43 -07002427 hideTimeoutMilliseconds = o.hideTimeoutMilliseconds;
Robert Carr70f0d222016-04-10 16:33:08 -07002428
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002429 return changes;
2430 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002431
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002432 @Override
2433 public String debug(String output) {
2434 output += "Contents of " + this + ":";
2435 Log.d("Debug", output);
2436 output = super.debug("");
2437 Log.d("Debug", output);
2438 Log.d("Debug", "");
2439 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
2440 return "";
2441 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002442
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002443 @Override
2444 public String toString() {
2445 StringBuilder sb = new StringBuilder(256);
2446 sb.append("WM.LayoutParams{");
2447 sb.append("(");
2448 sb.append(x);
2449 sb.append(',');
2450 sb.append(y);
2451 sb.append(")(");
Romain Guy48327452017-01-23 17:03:35 -08002452 sb.append((width == MATCH_PARENT ? "fill" : (width == WRAP_CONTENT
2453 ? "wrap" : String.valueOf(width))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002454 sb.append('x');
Romain Guy48327452017-01-23 17:03:35 -08002455 sb.append((height == MATCH_PARENT ? "fill" : (height == WRAP_CONTENT
2456 ? "wrap" : String.valueOf(height))));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002457 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002458 if (horizontalMargin != 0) {
2459 sb.append(" hm=");
2460 sb.append(horizontalMargin);
2461 }
2462 if (verticalMargin != 0) {
2463 sb.append(" vm=");
2464 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002465 }
2466 if (gravity != 0) {
2467 sb.append(" gr=#");
2468 sb.append(Integer.toHexString(gravity));
2469 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002470 if (softInputMode != 0) {
2471 sb.append(" sim=#");
2472 sb.append(Integer.toHexString(softInputMode));
2473 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002474 sb.append(" ty=");
2475 sb.append(type);
2476 sb.append(" fl=#");
2477 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002478 if (privateFlags != 0) {
Adam Lesinski95c42972013-10-02 10:13:27 -07002479 if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
2480 sb.append(" compatible=true");
2481 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07002482 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
2483 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07002484 if (format != PixelFormat.OPAQUE) {
2485 sb.append(" fmt=");
2486 sb.append(format);
2487 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002488 if (windowAnimations != 0) {
2489 sb.append(" wanim=0x");
2490 sb.append(Integer.toHexString(windowAnimations));
2491 }
2492 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
2493 sb.append(" or=");
2494 sb.append(screenOrientation);
2495 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07002496 if (alpha != 1.0f) {
2497 sb.append(" alpha=");
2498 sb.append(alpha);
2499 }
2500 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
2501 sb.append(" sbrt=");
2502 sb.append(screenBrightness);
2503 }
2504 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
2505 sb.append(" bbrt=");
2506 sb.append(buttonBrightness);
2507 }
Craig Mautner3c174372013-02-21 17:54:37 -08002508 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
2509 sb.append(" rotAnim=");
2510 sb.append(rotationAnimation);
2511 }
Michael Wright3f145a22014-07-22 19:46:03 -07002512 if (preferredRefreshRate != 0) {
2513 sb.append(" preferredRefreshRate=");
2514 sb.append(preferredRefreshRate);
2515 }
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -07002516 if (preferredDisplayModeId != 0) {
2517 sb.append(" preferredDisplayMode=");
2518 sb.append(preferredDisplayModeId);
2519 }
Joe Onorato664644d2011-01-23 17:53:23 -08002520 if (systemUiVisibility != 0) {
2521 sb.append(" sysui=0x");
2522 sb.append(Integer.toHexString(systemUiVisibility));
2523 }
Joe Onorato14782f72011-01-25 19:53:17 -08002524 if (subtreeSystemUiVisibility != 0) {
2525 sb.append(" vsysui=0x");
2526 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
2527 }
Joe Onorato664644d2011-01-23 17:53:23 -08002528 if (hasSystemUiListeners) {
2529 sb.append(" sysuil=");
2530 sb.append(hasSystemUiListeners);
2531 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07002532 if (inputFeatures != 0) {
2533 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
2534 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002535 if (userActivityTimeout >= 0) {
2536 sb.append(" userActivityTimeout=").append(userActivityTimeout);
2537 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07002538 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Wale Ogunwale246c2092016-04-07 14:12:44 -07002539 surfaceInsets.bottom != 0 || hasManualSurfaceInsets
2540 || !preservePreviousSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07002541 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08002542 if (hasManualSurfaceInsets) {
2543 sb.append(" (manual)");
2544 }
Wale Ogunwale246c2092016-04-07 14:12:44 -07002545 if (!preservePreviousSurfaceInsets) {
2546 sb.append(" (!preservePreviousSurfaceInsets)");
2547 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07002548 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002549 if (needsMenuKey != NEEDS_MENU_UNSET) {
2550 sb.append(" needsMenuKey=");
2551 sb.append(needsMenuKey);
2552 }
Romain Guy48327452017-01-23 17:03:35 -08002553 sb.append(" colorMode=").append(mColorMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002554 sb.append('}');
2555 return sb.toString();
2556 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002557
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002558 /**
Steven Timotiusaf03df62017-07-18 16:56:43 -07002559 * @hide
2560 */
2561 public void writeToProto(ProtoOutputStream proto, long fieldId) {
2562 final long token = proto.start(fieldId);
2563 proto.write(WindowLayoutParamsProto.TYPE, type);
2564 proto.end(token);
2565 }
2566
2567 /**
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002568 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002569 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002570 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002571 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002572 x = (int) (x * scale + 0.5f);
2573 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002574 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002575 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002576 }
2577 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002578 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002579 }
2580 }
2581
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002582 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002583 * Backup the layout parameters used in compatibility mode.
2584 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002585 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002586 void backup() {
2587 int[] backup = mCompatibilityParamsBackup;
2588 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002589 // we backup 4 elements, x, y, width, height
2590 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002591 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002592 backup[0] = x;
2593 backup[1] = y;
2594 backup[2] = width;
2595 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002596 }
2597
2598 /**
2599 * Restore the layout params' coordinates, size and gravity
2600 * @see LayoutParams#backup()
2601 */
2602 void restore() {
2603 int[] backup = mCompatibilityParamsBackup;
2604 if (backup != null) {
2605 x = backup[0];
2606 y = backup[1];
2607 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002608 height = backup[3];
2609 }
2610 }
2611
Wale Ogunwaleb6e2ead2016-02-15 08:28:47 -08002612 private CharSequence mTitle = null;
Siva Velusamy0d857b92015-04-22 10:23:56 -07002613
2614 /** @hide */
2615 @Override
2616 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
2617 super.encodeProperties(encoder);
2618
2619 encoder.addProperty("x", x);
2620 encoder.addProperty("y", y);
2621 encoder.addProperty("horizontalWeight", horizontalWeight);
2622 encoder.addProperty("verticalWeight", verticalWeight);
2623 encoder.addProperty("type", type);
2624 encoder.addProperty("flags", flags);
2625 }
Jorim Jaggie6c6ecb2017-07-20 18:09:20 +02002626
2627 /**
2628 * @hide
2629 * @return True if the layout parameters will cause the window to cover the full screen;
2630 * false otherwise.
2631 */
2632 public boolean isFullscreen() {
2633 return x == 0 && y == 0
2634 && width == WindowManager.LayoutParams.MATCH_PARENT
2635 && height == WindowManager.LayoutParams.MATCH_PARENT;
2636 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002637 }
2638}