blob: 123d9e76071b1af5f70b55c63df4ecd5ff0bc3ad [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
19import android.content.pm.ActivityInfo;
20import android.graphics.PixelFormat;
21import android.os.IBinder;
22import android.os.Parcel;
23import android.os.Parcelable;
24import android.text.TextUtils;
25import android.util.Log;
26
27
28/**
29 * The interface that apps use to talk to the window manager.
30 * <p>
31 * Use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> to get one of these.
32 *
33 * @see android.content.Context#getSystemService
34 * @see android.content.Context#WINDOW_SERVICE
35 */
36public interface WindowManager extends ViewManager {
37 /**
38 * Exception that is thrown when trying to add view whose
39 * {@link WindowManager.LayoutParams} {@link WindowManager.LayoutParams#token}
40 * is invalid.
41 */
42 public static class BadTokenException extends RuntimeException {
43 public BadTokenException() {
44 }
45
46 public BadTokenException(String name) {
47 super(name);
48 }
49 }
50
51 /**
52 * Use this method to get the default Display object.
53 *
54 * @return default Display object
55 */
56 public Display getDefaultDisplay();
57
58 /**
59 * Special variation of {@link #removeView} that immediately invokes
60 * the given view hierarchy's {@link View#onDetachedFromWindow()
61 * View.onDetachedFromWindow()} methods before returning. This is not
62 * for normal applications; using it correctly requires great care.
63 *
64 * @param view The view to be removed.
65 */
66 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -070067
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 public static class LayoutParams extends ViewGroup.LayoutParams
69 implements Parcelable {
70 /**
71 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -070072 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
73 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 */
Romain Guy529b60a2010-08-03 18:05:47 -070075 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 public int x;
77
78 /**
79 * Y position for this window. With the default gravity it is ignored.
80 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
81 * an offset from the given edge.
82 */
Romain Guy529b60a2010-08-03 18:05:47 -070083 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080084 public int y;
85
86 /**
87 * Indicates how much of the extra space will be allocated horizontally
88 * to the view associated with these LayoutParams. Specify 0 if the view
89 * should not be stretched. Otherwise the extra pixels will be pro-rated
90 * among all views whose weight is greater than 0.
91 */
Romain Guy529b60a2010-08-03 18:05:47 -070092 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 public float horizontalWeight;
94
95 /**
96 * Indicates how much of the extra space will be allocated vertically
97 * to the view associated with these LayoutParams. Specify 0 if the view
98 * should not be stretched. Otherwise the extra pixels will be pro-rated
99 * among all views whose weight is greater than 0.
100 */
Romain Guy529b60a2010-08-03 18:05:47 -0700101 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700103
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800104 /**
105 * The general type of window. There are three main classes of
106 * window types:
107 * <ul>
108 * <li> <strong>Application windows</strong> (ranging from
109 * {@link #FIRST_APPLICATION_WINDOW} to
110 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
111 * windows. For these types of windows, the {@link #token} must be
112 * set to the token of the activity they are a part of (this will
113 * normally be done for you if {@link #token} is null).
114 * <li> <strong>Sub-windows</strong> (ranging from
115 * {@link #FIRST_SUB_WINDOW} to
116 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
117 * window. For these types of windows, the {@link #token} must be
118 * the token of the window it is attached to.
119 * <li> <strong>System windows</strong> (ranging from
120 * {@link #FIRST_SYSTEM_WINDOW} to
121 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
122 * use by the system for specific purposes. They should not normally
123 * be used by applications, and a special permission is required
124 * to use them.
125 * </ul>
126 *
127 * @see #TYPE_BASE_APPLICATION
128 * @see #TYPE_APPLICATION
129 * @see #TYPE_APPLICATION_STARTING
130 * @see #TYPE_APPLICATION_PANEL
131 * @see #TYPE_APPLICATION_MEDIA
132 * @see #TYPE_APPLICATION_SUB_PANEL
133 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
134 * @see #TYPE_STATUS_BAR
135 * @see #TYPE_SEARCH_BAR
136 * @see #TYPE_PHONE
137 * @see #TYPE_SYSTEM_ALERT
138 * @see #TYPE_KEYGUARD
139 * @see #TYPE_TOAST
140 * @see #TYPE_SYSTEM_OVERLAY
141 * @see #TYPE_PRIORITY_PHONE
142 * @see #TYPE_STATUS_BAR_PANEL
143 * @see #TYPE_SYSTEM_DIALOG
144 * @see #TYPE_KEYGUARD_DIALOG
145 * @see #TYPE_SYSTEM_ERROR
146 * @see #TYPE_INPUT_METHOD
147 * @see #TYPE_INPUT_METHOD_DIALOG
148 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700149 @ViewDebug.ExportedProperty(mapping = {
150 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
151 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
152 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
153 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
154 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
155 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
156 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700157 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700158 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
159 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
160 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
161 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
162 @ViewDebug.IntToString(from = TYPE_KEYGUARD, to = "TYPE_KEYGUARD"),
163 @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
164 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
165 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700166 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"),
167 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
168 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
169 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
Jeff Brown3b2b3542010-10-15 00:54:27 -0700170 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700171 @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
172 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700173 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700174 @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
175 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
176 @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
177 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
178 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700179 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
180 @ViewDebug.IntToString(from = TYPE_HIDDEN_NAV_CONSUMER, to = "TYPE_HIDDEN_NAV_CONSUMER"),
181 @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
182 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700183 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800184 public int type;
185
186 /**
187 * Start of window types that represent normal application windows.
188 */
189 public static final int FIRST_APPLICATION_WINDOW = 1;
190
191 /**
192 * Window type: an application window that serves as the "base" window
193 * of the overall application; all other application windows will
194 * appear on top of it.
195 */
196 public static final int TYPE_BASE_APPLICATION = 1;
197
198 /**
199 * Window type: a normal application window. The {@link #token} must be
200 * an Activity token identifying who the window belongs to.
201 */
202 public static final int TYPE_APPLICATION = 2;
203
204 /**
205 * Window type: special application window that is displayed while the
206 * application is starting. Not for use by applications themselves;
207 * this is used by the system to display something until the
208 * application can show its own windows.
209 */
210 public static final int TYPE_APPLICATION_STARTING = 3;
211
212 /**
213 * End of types of application windows.
214 */
215 public static final int LAST_APPLICATION_WINDOW = 99;
216
217 /**
218 * Start of types of sub-windows. The {@link #token} of these windows
219 * must be set to the window they are attached to. These types of
220 * windows are kept next to their attached window in Z-order, and their
221 * coordinate space is relative to their attached window.
222 */
223 public static final int FIRST_SUB_WINDOW = 1000;
224
225 /**
226 * Window type: a panel on top of an application window. These windows
227 * appear on top of their attached window.
228 */
229 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
230
231 /**
232 * Window type: window for showing media (e.g. video). These windows
233 * are displayed behind their attached window.
234 */
235 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1;
236
237 /**
238 * Window type: a sub-panel on top of an application window. These
239 * windows are displayed on top their attached window and any
240 * {@link #TYPE_APPLICATION_PANEL} panels.
241 */
242 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW+2;
243
244 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
245 * of the window happens as that of a top-level window, <em>not</em>
246 * as a child of its container.
247 */
248 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3;
249
250 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700251 * Window type: window for showing overlays on top of media windows.
252 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
253 * application window. They should be translucent to be useful. This
254 * is a big ugly hack so:
255 * @hide
256 */
257 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4;
258
259 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800260 * End of types of sub-windows.
261 */
262 public static final int LAST_SUB_WINDOW = 1999;
263
264 /**
265 * Start of system-specific window types. These are not normally
266 * created by applications.
267 */
268 public static final int FIRST_SYSTEM_WINDOW = 2000;
269
270 /**
271 * Window type: the status bar. There can be only one status bar
272 * window; it is placed at the top of the screen, and all other
273 * windows are shifted down so they are below it.
274 */
275 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
276
277 /**
278 * Window type: the search bar. There can be only one search bar
279 * window; it is placed at the top of the screen.
280 */
281 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
282
283 /**
284 * Window type: phone. These are non-application windows providing
285 * user interaction with the phone (in particular incoming calls).
286 * These windows are normally placed above all applications, but behind
287 * the status bar.
288 */
289 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
290
291 /**
292 * Window type: system window, such as low power alert. These windows
293 * are always on top of application windows.
294 */
295 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
296
297 /**
298 * Window type: keyguard window.
299 */
300 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
301
302 /**
303 * Window type: transient notifications.
304 */
305 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
306
307 /**
308 * Window type: system overlay windows, which need to be displayed
309 * on top of everything else. These windows must not take input
310 * focus, or they will interfere with the keyguard.
311 */
312 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
313
314 /**
315 * Window type: priority phone UI, which needs to be displayed even if
316 * the keyguard is active. These windows must not take input
317 * focus, or they will interfere with the keyguard.
318 */
319 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
320
321 /**
322 * Window type: panel that slides out from the status bar
323 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800324 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
325
326 /**
327 * Window type: dialogs that the keyguard shows
328 */
329 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
330
331 /**
332 * Window type: internal system error windows, appear on top of
333 * everything they can.
334 */
335 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
336
337 /**
338 * Window type: internal input methods windows, which appear above
339 * the normal UI. Application windows may be resized or panned to keep
340 * the input focus visible while this window is displayed.
341 */
342 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
343
344 /**
345 * Window type: internal input methods dialog windows, which appear above
346 * the current input method window.
347 */
348 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
349
350 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700351 * Window type: wallpaper window, placed behind any window that wants
352 * to sit on top of the wallpaper.
353 */
354 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
355
356 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800357 * Window type: panel that slides out from over the status bar
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800358 */
359 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700360
361 /**
362 * Window type: secure system overlay windows, which need to be displayed
363 * on top of everything else. These windows must not take input
364 * focus, or they will interfere with the keyguard.
365 *
366 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
367 * system itself is allowed to create these overlays. Applications cannot
368 * obtain permission to create secure system overlays.
369 * @hide
370 */
371 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
372
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800373 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700374 * Window type: the drag-and-drop pseudowindow. There is only one
375 * drag layer (at most), and it is placed on top of all other windows.
376 * @hide
377 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700378 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700379
380 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800381 * Window type: panel that slides out from under the status bar
Joe Onoratoa89e9032010-11-24 11:13:44 -0800382 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800383 */
384 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
385
Jeff Brown83c09682010-12-23 17:50:18 -0800386 /**
387 * Window type: (mouse) pointer
388 * @hide
389 */
390 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800391
392 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400393 * Window type: Navigation bar (when distinct from status bar)
394 * @hide
395 */
396 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
397
398 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700399 * Window type: The volume level overlay/dialog shown when the user
400 * changes the system volume.
401 * @hide
402 */
403 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
404
405 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700406 * Window type: The boot progress dialog, goes on top of everything
407 * in the world.
408 * @hide
409 */
410 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
411
412 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700413 * Window type: Fake window to consume touch events when the navigation
414 * bar is hidden.
415 * @hide
416 */
417 public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22;
418
419 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500420 * Window type: Dreams (screen saver) window, just above keyguard.
421 * @hide
422 */
423 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
424
425 /**
Jim Millere898ac52012-04-06 17:10:57 -0700426 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
427 * @hide
428 */
429 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
430
431 /**
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700432 * Window type: Behind the universe of the real windows.
433 * @hide
434 */
435 public static final int TYPE_UNIVERSE_BACKGROUND = FIRST_SYSTEM_WINDOW+25;
436
437 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800438 * End of types of system windows.
439 */
440 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800441
Mathias Agopiand2112302010-12-07 19:38:17 -0800442 /** @deprecated this is ignored, this value is set automatically when needed. */
443 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800445 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700446 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800448 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700449 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800450 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800451 /** @deprecated this is ignored, this value is set automatically when needed. */
452 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800453 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700454
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800455 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700456 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800457 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700458 @Deprecated
459 public int memoryType;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800460
Mike Lockwoodef731622010-01-27 17:51:34 -0500461 /** Window flag: as long as this window is visible to the user, allow
462 * the lock screen to activate while the screen is on.
463 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800464 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500465 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
466
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 /** Window flag: everything behind this window will be dimmed.
468 * Use {@link #dimAmount} to control the amount of dim. */
469 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700470
471 /** Window flag: blur everything behind this window.
472 * @deprecated Blurring is no longer supported. */
473 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800474 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700475
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800476 /** Window flag: this window won't ever get key input focus, so the
477 * user can not send key or other button events to it. Those will
478 * instead go to whatever focusable window is behind it. This flag
479 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
480 * is explicitly set.
481 *
482 * <p>Setting this flag also implies that the window will not need to
483 * interact with
484 * a soft input method, so it will be Z-ordered and positioned
485 * independently of any active input method (typically this means it
486 * gets Z-ordered on top of the input method, so it can use the full
487 * screen for its content and cover the input method if needed. You
488 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
489 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
490
491 /** Window flag: this window can never receive touch events. */
492 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
493
494 /** Window flag: Even when this window is focusable (its
495 * {@link #FLAG_NOT_FOCUSABLE is not set), allow any pointer events
496 * outside of the window to be sent to the windows behind it. Otherwise
497 * it will consume all pointer events itself, regardless of whether they
498 * are inside of the window. */
499 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
500
501 /** Window flag: When set, if the device is asleep when the touch
502 * screen is pressed, you will receive this first touch event. Usually
503 * the first touch event is consumed by the system since the user can
504 * not see what they are pressing on.
505 */
506 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
507
508 /** Window flag: as long as this window is visible to the user, keep
509 * the device's screen turned on and bright. */
510 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
511
512 /** Window flag: place the window within the entire screen, ignoring
513 * decorations around the border (a.k.a. the status bar). The
514 * window must correctly position its contents to take the screen
515 * decoration into account. This flag is normally set for you
516 * by Window as described in {@link Window#setFlags}. */
517 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
518
519 /** Window flag: allow window to extend outside of the screen. */
520 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
521
522 /** Window flag: Hide all screen decorations (e.g. status bar) while
523 * this window is displayed. This allows the window to use the entire
524 * display space for itself -- the status bar will be hidden when
525 * an app window with this flag set is on the top layer. */
526 public static final int FLAG_FULLSCREEN = 0x00000400;
527
528 /** Window flag: Override {@link #FLAG_FULLSCREEN and force the
529 * screen decorations (such as status bar) to be shown. */
530 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
531
532 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700533 * the screen.
534 * @deprecated This flag is no longer used. */
535 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 public static final int FLAG_DITHER = 0x00001000;
537
538 /** Window flag: don't allow screen shots while this window is
Glenn Kastend6f5bde2011-01-19 15:27:27 -0800539 * displayed. Maps to Surface.SECURE. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 public static final int FLAG_SECURE = 0x00002000;
541
542 /** Window flag: a special mode where the layout parameters are used
543 * to perform scaling of the surface when it is composited to the
544 * screen. */
545 public static final int FLAG_SCALED = 0x00004000;
546
547 /** Window flag: intended for windows that will often be used when the user is
548 * holding the screen against their face, it will aggressively filter the event
549 * stream to prevent unintended presses in this situation that may not be
550 * desired for a particular window, when such an event stream is detected, the
551 * application will receive a CANCEL motion event to indicate this so applications
552 * can handle this accordingly by taking no action on the event
553 * until the finger is released. */
554 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
555
556 /** Window flag: a special option only for use in combination with
557 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
558 * screen your window may appear on top of or behind screen decorations
559 * such as the status bar. By also including this flag, the window
560 * manager will report the inset rectangle needed to ensure your
561 * content is not covered by screen decorations. This flag is normally
562 * set for you by Window as described in {@link Window#setFlags}.*/
563 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
564
565 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
566 * respect to how this window interacts with the current method. That
567 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
568 * window will behave as if it needs to interact with the input method
569 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
570 * not set and this flag is set, then the window will behave as if it
571 * doesn't need to interact with the input method and can be placed
572 * to use more space and cover the input method.
573 */
574 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
575
576 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
577 * can set this flag to receive a single special MotionEvent with
578 * the action
579 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
580 * touches that occur outside of your window. Note that you will not
581 * receive the full down/move/up gesture, only the location of the
582 * first down as an ACTION_OUTSIDE.
583 */
584 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
585
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700586 /** Window flag: special flag to let windows be shown when the screen
587 * is locked. This will let application windows take precedence over
588 * key guard or any other lock screens. Can be used with
589 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700590 * directly before showing the key guard window. Can be used with
591 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
592 * non-secure keyguards. This flag only applies to the top-most
593 * full-screen window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700594 */
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700595 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
596
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700597 /** Window flag: ask that the system wallpaper be shown behind
598 * your window. The window surface must be translucent to be able
599 * to actually see the wallpaper behind it; this flag just ensures
600 * that the wallpaper surface will be there if this window actually
601 * has translucent regions.
602 */
603 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
604
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700605 /** Window flag: when set as a window is being added or made
606 * visible, once the window has been shown then the system will
607 * poke the power manager's user activity (as if the user had woken
608 * up the device) to turn the screen on. */
609 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
610
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700611 /** Window flag: when set the window will cause the keyguard to
612 * be dismissed, only if it is not a secure lock keyguard. Because such
613 * a keyguard is not needed for security, it will never re-appear if
614 * the user navigates to another window (in contrast to
615 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
616 * hide both secure and non-secure keyguards but ensure they reappear
617 * when the user moves to another UI that doesn't hide them).
618 * If the keyguard is currently active and is secure (requires an
619 * unlock pattern) than the user will still need to confirm it before
620 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
Daniel Sandlerae069f72010-06-17 21:56:26 -0400621 * also been set.
622 */
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700623 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
Jeff Brown01ce2e92010-09-26 22:20:12 -0700624
625 /** Window flag: when set the window will accept for touch events
626 * outside of its bounds to be sent to other windows that also
627 * support split touch. When this flag is not set, the first pointer
628 * that goes down determines the window to which all subsequent touches
629 * go until all pointers go up. When this flag is set, each pointer
630 * (not necessarily the first) that goes down determines the window
631 * to which all subsequent touches of that pointer will go until that
632 * pointer goes up thereby enabling touches with multiple pointers
633 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800634 */
Jeff Brown01ce2e92010-09-26 22:20:12 -0700635 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800636
637 /**
Romain Guy72f0a272011-01-09 16:01:46 -0800638 * <p>Indicates whether this window should be hardware accelerated.
639 * Requesting hardware acceleration does not guarantee it will happen.</p>
640 *
641 * <p>This flag can be controlled programmatically <em>only</em> to enable
642 * hardware acceleration. To enable hardware acceleration for a given
643 * window programmatically, do the following:</p>
644 *
645 * <pre>
646 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
647 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
648 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
649 * </pre>
650 *
651 * <p>It is important to remember that this flag <strong>must</strong>
652 * be set before setting the content view of your activity or dialog.</p>
653 *
654 * <p>This flag cannot be used to disable hardware acceleration after it
655 * was enabled in your manifest using
656 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
657 * and programmatically disable hardware acceleration (for automated testing
658 * for instance), make sure it is turned off in your manifest and enable it
659 * on your activity or dialog when you need it instead, using the method
660 * described above.</p>
661 *
662 * <p>This flag is automatically set by the system if the
663 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
664 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800665 */
666 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -0400667
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800668 // ----- HIDDEN FLAGS.
669 // These start at the high bit and go down.
Jeff Brown98db5fa2011-06-08 15:37:10 -0700670
671 /** Window flag: Enable touches to slide out of a window into neighboring
672 * windows in mid-gesture instead of being captured for the duration of
673 * the gesture.
674 *
675 * This flag changes the behavior of touch focus for this window only.
676 * Touches can slide out of the window but they cannot necessarily slide
677 * back in (unless the other window with touch focus permits it).
678 *
679 * {@hide}
680 */
681 public static final int FLAG_SLIPPERY = 0x04000000;
682
Daniel Sandlere02d8082010-10-08 15:13:22 -0400683 /**
684 * Flag for a window belonging to an activity that responds to {@link KeyEvent#KEYCODE_MENU}
685 * and therefore needs a Menu key. For devices where Menu is a physical button this flag is
686 * ignored, but on devices where the Menu key is drawn in software it may be hidden unless
687 * this flag is set.
688 *
689 * (Note that Action Bars, when available, are the preferred way to offer additional
690 * functions otherwise accessed via an options menu.)
691 *
692 * {@hide}
693 */
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800694 public static final int FLAG_NEEDS_MENU_KEY = 0x08000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -0400695
Mitsuru Oshima1ecf5d22009-07-06 17:20:38 -0700696 /** Window flag: special flag to limit the size of the window to be
697 * original size ([320x480] x density). Used to create window for applications
698 * running under compatibility mode.
699 *
700 * {@hide} */
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700701 public static final int FLAG_COMPATIBLE_WINDOW = 0x20000000;
Mitsuru Oshima1ecf5d22009-07-06 17:20:38 -0700702
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703 /** Window flag: a special option intended for system dialogs. When
704 * this flag is set, the window will demand focus unconditionally when
705 * it is created.
706 * {@hide} */
707 public static final int FLAG_SYSTEM_ERROR = 0x40000000;
708
709 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700710 * Various behavioral options/flags. Default is none.
711 *
712 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
713 * @see #FLAG_DIM_BEHIND
714 * @see #FLAG_NOT_FOCUSABLE
715 * @see #FLAG_NOT_TOUCHABLE
716 * @see #FLAG_NOT_TOUCH_MODAL
717 * @see #FLAG_TOUCHABLE_WHEN_WAKING
718 * @see #FLAG_KEEP_SCREEN_ON
719 * @see #FLAG_LAYOUT_IN_SCREEN
720 * @see #FLAG_LAYOUT_NO_LIMITS
721 * @see #FLAG_FULLSCREEN
722 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700723 * @see #FLAG_SECURE
724 * @see #FLAG_SCALED
725 * @see #FLAG_IGNORE_CHEEK_PRESSES
726 * @see #FLAG_LAYOUT_INSET_DECOR
727 * @see #FLAG_ALT_FOCUSABLE_IM
728 * @see #FLAG_WATCH_OUTSIDE_TOUCH
729 * @see #FLAG_SHOW_WHEN_LOCKED
730 * @see #FLAG_SHOW_WALLPAPER
731 * @see #FLAG_TURN_SCREEN_ON
732 * @see #FLAG_DISMISS_KEYGUARD
733 * @see #FLAG_SPLIT_TOUCH
734 * @see #FLAG_HARDWARE_ACCELERATED
735 */
736 @ViewDebug.ExportedProperty(flagMapping = {
737 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
738 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
739 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
740 name = "FLAG_DIM_BEHIND"),
741 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
742 name = "FLAG_BLUR_BEHIND"),
743 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
744 name = "FLAG_NOT_FOCUSABLE"),
745 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
746 name = "FLAG_NOT_TOUCHABLE"),
747 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
748 name = "FLAG_NOT_TOUCH_MODAL"),
749 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
750 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
751 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
752 name = "FLAG_KEEP_SCREEN_ON"),
753 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
754 name = "FLAG_LAYOUT_IN_SCREEN"),
755 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
756 name = "FLAG_LAYOUT_NO_LIMITS"),
757 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
758 name = "FLAG_FULLSCREEN"),
759 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
760 name = "FLAG_FORCE_NOT_FULLSCREEN"),
761 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
762 name = "FLAG_DITHER"),
763 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
764 name = "FLAG_SECURE"),
765 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
766 name = "FLAG_SCALED"),
767 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
768 name = "FLAG_IGNORE_CHEEK_PRESSES"),
769 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
770 name = "FLAG_LAYOUT_INSET_DECOR"),
771 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
772 name = "FLAG_ALT_FOCUSABLE_IM"),
773 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
774 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
775 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
776 name = "FLAG_SHOW_WHEN_LOCKED"),
777 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
778 name = "FLAG_SHOW_WALLPAPER"),
779 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
780 name = "FLAG_TURN_SCREEN_ON"),
781 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
782 name = "FLAG_DISMISS_KEYGUARD"),
783 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
784 name = "FLAG_SPLIT_TOUCH"),
785 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
786 name = "FLAG_HARDWARE_ACCELERATED")
787 })
788 public int flags;
789
790 /**
791 * If the window has requested hardware acceleration, but this is not
792 * allowed in the process it is in, then still render it as if it is
793 * hardware accelerated. This is used for the starting preview windows
794 * in the system process, which don't need to have the overhead of
795 * hardware acceleration (they are just a static rendering), but should
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900796 * be rendered as such to match the actual window of the app even if it
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700797 * is hardware accelerated.
798 * Even if the window isn't hardware accelerated, still do its rendering
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900799 * as if it was.
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700800 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
801 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
802 * is generally disabled. This flag must be specified in addition to
803 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
804 * windows.
805 *
806 * @hide
807 */
808 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
809
810 /**
811 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900812 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700813 * If certain parts of the UI that really do want to use hardware
814 * acceleration, this flag can be set to force it. This is basically
815 * for the lock screen. Anyone else using it, you are probably wrong.
816 *
817 * @hide
818 */
819 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
820
821 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -0700822 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900823 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -0700824 * them (they do not affect the wallpaper scrolling operation) by calling
825 * {@link
826 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
827 *
828 * @hide
829 */
830 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
831
832 /**
Dianne Hackborn73ab6a42011-12-13 11:16:23 -0800833 * This is set for a window that has explicitly specified its
834 * FLAG_NEEDS_MENU_KEY, so we know the value on this window is the
835 * appropriate one to use. If this is not set, we should look at
836 * windows behind it to determine the appropriate value.
837 *
838 * @hide
839 */
840 public static final int PRIVATE_FLAG_SET_NEEDS_MENU_KEY = 0x00000008;
841
842 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700843 * Control flags that are private to the platform.
844 * @hide
845 */
846 public int privateFlags;
847
848 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800849 * Given a particular set of window manager flags, determine whether
850 * such a window may be a target for an input method when it has
851 * focus. In particular, this checks the
852 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
853 * flags and returns true if the combination of the two corresponds
854 * to a window that needs to be behind the input method so that the
855 * user can type into it.
856 *
857 * @param flags The current window manager flags.
858 *
859 * @return Returns true if such a window should be behind/interact
860 * with an input method, false if not.
861 */
862 public static boolean mayUseInputMethod(int flags) {
863 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
864 case 0:
865 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
866 return true;
867 }
868 return false;
869 }
870
871 /**
872 * Mask for {@link #softInputMode} of the bits that determine the
873 * desired visibility state of the soft input area for this window.
874 */
875 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
876
877 /**
878 * Visibility state for {@link #softInputMode}: no state has been specified.
879 */
880 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
881
882 /**
883 * Visibility state for {@link #softInputMode}: please don't change the state of
884 * the soft input area.
885 */
886 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
887
888 /**
889 * Visibility state for {@link #softInputMode}: please hide any soft input
890 * area when normally appropriate (when the user is navigating
891 * forward to your window).
892 */
893 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
894
895 /**
896 * Visibility state for {@link #softInputMode}: please always hide any
897 * soft input area when this window receives focus.
898 */
899 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
900
901 /**
902 * Visibility state for {@link #softInputMode}: please show the soft
903 * input area when normally appropriate (when the user is navigating
904 * forward to your window).
905 */
906 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
907
908 /**
909 * Visibility state for {@link #softInputMode}: please always make the
910 * soft input area visible when this window receives input focus.
911 */
912 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
913
914 /**
915 * Mask for {@link #softInputMode} of the bits that determine the
916 * way that the window should be adjusted to accommodate the soft
917 * input window.
918 */
919 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
920
921 /** Adjustment option for {@link #softInputMode}: nothing specified.
922 * The system will try to pick one or
923 * the other depending on the contents of the window.
924 */
925 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
926
927 /** Adjustment option for {@link #softInputMode}: set to allow the
928 * window to be resized when an input
929 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -0700930 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931 * {@link #SOFT_INPUT_ADJUST_PAN}; if
932 * neither of these are set, then the system will try to pick one or
933 * the other depending on the contents of the window.
934 */
935 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
936
937 /** Adjustment option for {@link #softInputMode}: set to have a window
938 * pan when an input method is
939 * shown, so it doesn't need to deal with resizing but just panned
940 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -0700941 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800942 * neither of these are set, then the system will try to pick one or
943 * the other depending on the contents of the window.
944 */
945 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
946
Dianne Hackborndea3ef72010-10-28 14:24:22 -0700947 /** Adjustment option for {@link #softInputMode}: set to have a window
948 * not adjust for a shown input method. The window will not be resized,
949 * and it will not be panned to make its focus visible.
950 */
951 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
952
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800953 /**
954 * Bit for {@link #softInputMode}: set when the user has navigated
955 * forward to the window. This is normally set automatically for
956 * you by the system, though you may want to set it in certain cases
957 * when you are displaying a window yourself. This flag will always
958 * be cleared automatically after the window is displayed.
959 */
960 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -0500961
962 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -0800963 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800964 * of:
965 *
966 * <ul>
967 * <li> One of the visibility states
968 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
969 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or
970 * {@link #SOFT_INPUT_STATE_VISIBLE}.
971 * <li> One of the adjustment options
972 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},
973 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or
974 * {@link #SOFT_INPUT_ADJUST_PAN}.
975 */
976 public int softInputMode;
977
978 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -0700979 * Placement of window within the screen as per {@link Gravity}. Both
980 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
981 * android.graphics.Rect) Gravity.apply} and
982 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
983 * Gravity.applyDisplay} are used during window layout, with this value
984 * given as the desired gravity. For example you can specify
985 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
986 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
987 * to control the behavior of
988 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
989 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800990 *
991 * @see Gravity
992 */
993 public int gravity;
994
995 /**
996 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -0700997 * between the container and the widget. See
998 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
999 * android.graphics.Rect) Gravity.apply} for how this is used. This
1000 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 */
1002 public float horizontalMargin;
1003
1004 /**
1005 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001006 * between the container and the widget. See
1007 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1008 * android.graphics.Rect) Gravity.apply} for how this is used. This
1009 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001010 */
1011 public float verticalMargin;
1012
1013 /**
1014 * The desired bitmap format. May be one of the constants in
1015 * {@link android.graphics.PixelFormat}. Default is OPAQUE.
1016 */
1017 public int format;
1018
1019 /**
1020 * A style resource defining the animations to use for this window.
1021 * This must be a system resource; it can not be an application resource
1022 * because the window manager does not have access to applications.
1023 */
1024 public int windowAnimations;
1025
1026 /**
1027 * An alpha value to apply to this entire window.
1028 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1029 */
1030 public float alpha = 1.0f;
1031
1032 /**
1033 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1034 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1035 * dim.
1036 */
1037 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001038
1039 /**
1040 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1041 * indicating that the brightness value is not overridden for this window
1042 * and normal brightness policy should be used.
1043 */
1044 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1045
1046 /**
1047 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1048 * indicating that the screen or button backlight brightness should be set
1049 * to the lowest value when this window is in front.
1050 */
1051 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1052
1053 /**
1054 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1055 * indicating that the screen or button backlight brightness should be set
1056 * to the hightest value when this window is in front.
1057 */
1058 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001059
1060 /**
1061 * This can be used to override the user's preferred brightness of
1062 * the screen. A value of less than 0, the default, means to use the
1063 * preferred screen brightness. 0 to 1 adjusts the brightness from
1064 * dark to full bright.
1065 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001066 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001067
1068 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001069 * This can be used to override the standard behavior of the button and
1070 * keyboard backlights. A value of less than 0, the default, means to
1071 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1072 * from dark to full bright.
1073 */
1074 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1075
1076 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001077 * Identifier for this window. This will usually be filled in for
1078 * you.
1079 */
1080 public IBinder token = null;
1081
1082 /**
1083 * Name of the package owning this window.
1084 */
1085 public String packageName = null;
1086
1087 /**
1088 * Specific orientation value for a window.
1089 * May be any of the same values allowed
1090 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1091 * If not set, a default value of
1092 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
1093 * will be used.
1094 */
1095 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001096
1097 /**
1098 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001099 *
1100 * @see View#STATUS_BAR_VISIBLE
1101 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001102 */
1103 public int systemUiVisibility;
1104
1105 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001106 * @hide
1107 * The ui visibility as requested by the views in this hierarchy.
1108 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1109 */
1110 public int subtreeSystemUiVisibility;
1111
1112 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001113 * Get callbacks about the system ui visibility changing.
1114 *
1115 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1116 *
1117 * @hide
1118 */
1119 public boolean hasSystemUiListeners;
1120
Jeff Brown474dcb52011-06-14 20:22:50 -07001121 /**
1122 * When this window has focus, disable touch pad pointer gesture processing.
1123 * The window will receive raw position updates from the touch pad instead
1124 * of pointer movements and synthetic touch events.
1125 *
1126 * @hide
1127 */
1128 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1129
1130 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001131 * Does not construct an input channel for this window. The channel will therefore
1132 * be incapable of receiving input.
1133 *
1134 * @hide
1135 */
1136 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1137
1138 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001139 * Control special features of the input subsystem.
1140 *
1141 * @see #INPUT_FEATURE_DISABLE_TOUCH_PAD_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001142 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown474dcb52011-06-14 20:22:50 -07001143 * @hide
1144 */
1145 public int inputFeatures;
1146
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001148 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001149 type = TYPE_APPLICATION;
1150 format = PixelFormat.OPAQUE;
1151 }
1152
1153 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001154 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001155 type = _type;
1156 format = PixelFormat.OPAQUE;
1157 }
1158
1159 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001160 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 type = _type;
1162 flags = _flags;
1163 format = PixelFormat.OPAQUE;
1164 }
1165
1166 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08001167 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001168 type = _type;
1169 flags = _flags;
1170 format = _format;
1171 }
1172
1173 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
1174 super(w, h);
1175 type = _type;
1176 flags = _flags;
1177 format = _format;
1178 }
1179
1180 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
1181 int _flags, int _format) {
1182 super(w, h);
1183 x = xpos;
1184 y = ypos;
1185 type = _type;
1186 flags = _flags;
1187 format = _format;
1188 }
1189
1190 public final void setTitle(CharSequence title) {
1191 if (null == title)
1192 title = "";
1193
1194 mTitle = TextUtils.stringOrSpannedString(title);
1195 }
1196
1197 public final CharSequence getTitle() {
1198 return mTitle;
1199 }
1200
1201 public int describeContents() {
1202 return 0;
1203 }
1204
1205 public void writeToParcel(Parcel out, int parcelableFlags) {
1206 out.writeInt(width);
1207 out.writeInt(height);
1208 out.writeInt(x);
1209 out.writeInt(y);
1210 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001211 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001212 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 out.writeInt(softInputMode);
1214 out.writeInt(gravity);
1215 out.writeFloat(horizontalMargin);
1216 out.writeFloat(verticalMargin);
1217 out.writeInt(format);
1218 out.writeInt(windowAnimations);
1219 out.writeFloat(alpha);
1220 out.writeFloat(dimAmount);
1221 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001222 out.writeFloat(buttonBrightness);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 out.writeStrongBinder(token);
1224 out.writeString(packageName);
1225 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
1226 out.writeInt(screenOrientation);
Joe Onorato664644d2011-01-23 17:53:23 -08001227 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08001228 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08001229 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07001230 out.writeInt(inputFeatures);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 }
1232
1233 public static final Parcelable.Creator<LayoutParams> CREATOR
1234 = new Parcelable.Creator<LayoutParams>() {
1235 public LayoutParams createFromParcel(Parcel in) {
1236 return new LayoutParams(in);
1237 }
1238
1239 public LayoutParams[] newArray(int size) {
1240 return new LayoutParams[size];
1241 }
1242 };
1243
1244
1245 public LayoutParams(Parcel in) {
1246 width = in.readInt();
1247 height = in.readInt();
1248 x = in.readInt();
1249 y = in.readInt();
1250 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001251 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001252 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 softInputMode = in.readInt();
1254 gravity = in.readInt();
1255 horizontalMargin = in.readFloat();
1256 verticalMargin = in.readFloat();
1257 format = in.readInt();
1258 windowAnimations = in.readInt();
1259 alpha = in.readFloat();
1260 dimAmount = in.readFloat();
1261 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001262 buttonBrightness = in.readFloat();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001263 token = in.readStrongBinder();
1264 packageName = in.readString();
1265 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
1266 screenOrientation = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001267 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08001268 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001269 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07001270 inputFeatures = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 }
1272
Romain Guy72998072009-06-22 11:09:20 -07001273 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274 public static final int LAYOUT_CHANGED = 1<<0;
1275 public static final int TYPE_CHANGED = 1<<1;
1276 public static final int FLAGS_CHANGED = 1<<2;
1277 public static final int FORMAT_CHANGED = 1<<3;
1278 public static final int ANIMATION_CHANGED = 1<<4;
1279 public static final int DIM_AMOUNT_CHANGED = 1<<5;
1280 public static final int TITLE_CHANGED = 1<<6;
1281 public static final int ALPHA_CHANGED = 1<<7;
1282 public static final int MEMORY_TYPE_CHANGED = 1<<8;
1283 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
1284 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
1285 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001286 /** {@hide} */
1287 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<12;
Joe Onorato664644d2011-01-23 17:53:23 -08001288 /** {@hide} */
1289 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<13;
1290 /** {@hide} */
1291 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<14;
Jeff Brown474dcb52011-06-14 20:22:50 -07001292 /** {@hide} */
1293 public static final int INPUT_FEATURES_CHANGED = 1<<15;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001294 /** {@hide} */
1295 public static final int PRIVATE_FLAGS_CHANGED = 1<<16;
Romain Guyf21c9b02011-09-06 16:56:54 -07001296 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07001297 public static final int EVERYTHING_CHANGED = 0xffffffff;
1298
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001299 // internal buffer to backup/restore parameters under compatibility mode.
1300 private int[] mCompatibilityParamsBackup = null;
1301
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001302 public final int copyFrom(LayoutParams o) {
1303 int changes = 0;
1304
1305 if (width != o.width) {
1306 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07001307 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001308 }
1309 if (height != o.height) {
1310 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07001311 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001312 }
1313 if (x != o.x) {
1314 x = o.x;
1315 changes |= LAYOUT_CHANGED;
1316 }
1317 if (y != o.y) {
1318 y = o.y;
1319 changes |= LAYOUT_CHANGED;
1320 }
1321 if (horizontalWeight != o.horizontalWeight) {
1322 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001323 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001324 }
1325 if (verticalWeight != o.verticalWeight) {
1326 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001327 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001328 }
1329 if (horizontalMargin != o.horizontalMargin) {
1330 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001331 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001332 }
1333 if (verticalMargin != o.verticalMargin) {
1334 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001335 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 }
1337 if (type != o.type) {
1338 type = o.type;
1339 changes |= TYPE_CHANGED;
1340 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001341 if (flags != o.flags) {
1342 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07001343 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001344 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001345 if (privateFlags != o.privateFlags) {
1346 privateFlags = o.privateFlags;
1347 changes |= PRIVATE_FLAGS_CHANGED;
1348 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001349 if (softInputMode != o.softInputMode) {
1350 softInputMode = o.softInputMode;
1351 changes |= SOFT_INPUT_MODE_CHANGED;
1352 }
1353 if (gravity != o.gravity) {
1354 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07001355 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001356 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001357 if (format != o.format) {
1358 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07001359 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001360 }
1361 if (windowAnimations != o.windowAnimations) {
1362 windowAnimations = o.windowAnimations;
1363 changes |= ANIMATION_CHANGED;
1364 }
1365 if (token == null) {
1366 // NOTE: token only copied if the recipient doesn't
1367 // already have one.
1368 token = o.token;
1369 }
1370 if (packageName == null) {
1371 // NOTE: packageName only copied if the recipient doesn't
1372 // already have one.
1373 packageName = o.packageName;
1374 }
1375 if (!mTitle.equals(o.mTitle)) {
1376 mTitle = o.mTitle;
1377 changes |= TITLE_CHANGED;
1378 }
1379 if (alpha != o.alpha) {
1380 alpha = o.alpha;
1381 changes |= ALPHA_CHANGED;
1382 }
1383 if (dimAmount != o.dimAmount) {
1384 dimAmount = o.dimAmount;
1385 changes |= DIM_AMOUNT_CHANGED;
1386 }
1387 if (screenBrightness != o.screenBrightness) {
1388 screenBrightness = o.screenBrightness;
1389 changes |= SCREEN_BRIGHTNESS_CHANGED;
1390 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001391 if (buttonBrightness != o.buttonBrightness) {
1392 buttonBrightness = o.buttonBrightness;
1393 changes |= BUTTON_BRIGHTNESS_CHANGED;
1394 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001395
1396 if (screenOrientation != o.screenOrientation) {
1397 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07001398 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001399 }
Romain Guy529b60a2010-08-03 18:05:47 -07001400
Joe Onorato14782f72011-01-25 19:53:17 -08001401 if (systemUiVisibility != o.systemUiVisibility
1402 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08001403 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08001404 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08001405 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
1406 }
1407
1408 if (hasSystemUiListeners != o.hasSystemUiListeners) {
1409 hasSystemUiListeners = o.hasSystemUiListeners;
1410 changes |= SYSTEM_UI_LISTENER_CHANGED;
1411 }
1412
Jeff Brown474dcb52011-06-14 20:22:50 -07001413 if (inputFeatures != o.inputFeatures) {
1414 inputFeatures = o.inputFeatures;
1415 changes |= INPUT_FEATURES_CHANGED;
1416 }
1417
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001418 return changes;
1419 }
1420
1421 @Override
1422 public String debug(String output) {
1423 output += "Contents of " + this + ":";
1424 Log.d("Debug", output);
1425 output = super.debug("");
1426 Log.d("Debug", output);
1427 Log.d("Debug", "");
1428 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
1429 return "";
1430 }
1431
1432 @Override
1433 public String toString() {
1434 StringBuilder sb = new StringBuilder(256);
1435 sb.append("WM.LayoutParams{");
1436 sb.append("(");
1437 sb.append(x);
1438 sb.append(',');
1439 sb.append(y);
1440 sb.append(")(");
Romain Guy980a9382010-01-08 15:06:28 -08001441 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001442 sb.append('x');
Romain Guy980a9382010-01-08 15:06:28 -08001443 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001444 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001445 if (horizontalMargin != 0) {
1446 sb.append(" hm=");
1447 sb.append(horizontalMargin);
1448 }
1449 if (verticalMargin != 0) {
1450 sb.append(" vm=");
1451 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001452 }
1453 if (gravity != 0) {
1454 sb.append(" gr=#");
1455 sb.append(Integer.toHexString(gravity));
1456 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001457 if (softInputMode != 0) {
1458 sb.append(" sim=#");
1459 sb.append(Integer.toHexString(softInputMode));
1460 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001461 sb.append(" ty=");
1462 sb.append(type);
1463 sb.append(" fl=#");
1464 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001465 if (privateFlags != 0) {
1466 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
1467 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001468 if (format != PixelFormat.OPAQUE) {
1469 sb.append(" fmt=");
1470 sb.append(format);
1471 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001472 if (windowAnimations != 0) {
1473 sb.append(" wanim=0x");
1474 sb.append(Integer.toHexString(windowAnimations));
1475 }
1476 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
1477 sb.append(" or=");
1478 sb.append(screenOrientation);
1479 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001480 if (alpha != 1.0f) {
1481 sb.append(" alpha=");
1482 sb.append(alpha);
1483 }
1484 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1485 sb.append(" sbrt=");
1486 sb.append(screenBrightness);
1487 }
1488 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1489 sb.append(" bbrt=");
1490 sb.append(buttonBrightness);
1491 }
Mitsuru Oshima5a2b91d2009-07-16 16:30:02 -07001492 if ((flags & FLAG_COMPATIBLE_WINDOW) != 0) {
1493 sb.append(" compatible=true");
1494 }
Joe Onorato664644d2011-01-23 17:53:23 -08001495 if (systemUiVisibility != 0) {
1496 sb.append(" sysui=0x");
1497 sb.append(Integer.toHexString(systemUiVisibility));
1498 }
Joe Onorato14782f72011-01-25 19:53:17 -08001499 if (subtreeSystemUiVisibility != 0) {
1500 sb.append(" vsysui=0x");
1501 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
1502 }
Joe Onorato664644d2011-01-23 17:53:23 -08001503 if (hasSystemUiListeners) {
1504 sb.append(" sysuil=");
1505 sb.append(hasSystemUiListeners);
1506 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001507 if (inputFeatures != 0) {
1508 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
1509 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001510 sb.append('}');
1511 return sb.toString();
1512 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001513
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001514 /**
1515 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001516 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001517 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001518 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001519 x = (int) (x * scale + 0.5f);
1520 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001521 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001522 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001523 }
1524 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001525 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001526 }
1527 }
1528
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001529 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001530 * Backup the layout parameters used in compatibility mode.
1531 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001532 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001533 void backup() {
1534 int[] backup = mCompatibilityParamsBackup;
1535 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001536 // we backup 4 elements, x, y, width, height
1537 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001538 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001539 backup[0] = x;
1540 backup[1] = y;
1541 backup[2] = width;
1542 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001543 }
1544
1545 /**
1546 * Restore the layout params' coordinates, size and gravity
1547 * @see LayoutParams#backup()
1548 */
1549 void restore() {
1550 int[] backup = mCompatibilityParamsBackup;
1551 if (backup != null) {
1552 x = backup[0];
1553 y = backup[1];
1554 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001555 height = backup[3];
1556 }
1557 }
1558
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001559 private CharSequence mTitle = "";
1560 }
1561}