blob: 0336b2fbc7b926ee637f3de2c0f60b763860ba83 [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);
67
Dianne Hackborn7eec10e2010-11-12 18:03:47 -080068 /**
69 * Return true if this window manager is configured to request hardware
70 * accelerated windows. This does <em>not</em> guarantee that they will
71 * actually be accelerated, since that depends on the device supporting them.
72 * @hide
73 */
74 public boolean isHardwareAccelerated();
75
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 public static class LayoutParams extends ViewGroup.LayoutParams
77 implements Parcelable {
78 /**
79 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -070080 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
81 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082 */
Romain Guy529b60a2010-08-03 18:05:47 -070083 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080084 public int x;
85
86 /**
87 * Y position for this window. With the default gravity it is ignored.
88 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
89 * an offset from the given edge.
90 */
Romain Guy529b60a2010-08-03 18:05:47 -070091 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080092 public int y;
93
94 /**
95 * Indicates how much of the extra space will be allocated horizontally
96 * to the view associated with these LayoutParams. Specify 0 if the view
97 * should not be stretched. Otherwise the extra pixels will be pro-rated
98 * among all views whose weight is greater than 0.
99 */
Romain Guy529b60a2010-08-03 18:05:47 -0700100 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 public float horizontalWeight;
102
103 /**
104 * Indicates how much of the extra space will be allocated vertically
105 * to the view associated with these LayoutParams. Specify 0 if the view
106 * should not be stretched. Otherwise the extra pixels will be pro-rated
107 * among all views whose weight is greater than 0.
108 */
Romain Guy529b60a2010-08-03 18:05:47 -0700109 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700111
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 /**
113 * The general type of window. There are three main classes of
114 * window types:
115 * <ul>
116 * <li> <strong>Application windows</strong> (ranging from
117 * {@link #FIRST_APPLICATION_WINDOW} to
118 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
119 * windows. For these types of windows, the {@link #token} must be
120 * set to the token of the activity they are a part of (this will
121 * normally be done for you if {@link #token} is null).
122 * <li> <strong>Sub-windows</strong> (ranging from
123 * {@link #FIRST_SUB_WINDOW} to
124 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
125 * window. For these types of windows, the {@link #token} must be
126 * the token of the window it is attached to.
127 * <li> <strong>System windows</strong> (ranging from
128 * {@link #FIRST_SYSTEM_WINDOW} to
129 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
130 * use by the system for specific purposes. They should not normally
131 * be used by applications, and a special permission is required
132 * to use them.
133 * </ul>
134 *
135 * @see #TYPE_BASE_APPLICATION
136 * @see #TYPE_APPLICATION
137 * @see #TYPE_APPLICATION_STARTING
138 * @see #TYPE_APPLICATION_PANEL
139 * @see #TYPE_APPLICATION_MEDIA
140 * @see #TYPE_APPLICATION_SUB_PANEL
141 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
142 * @see #TYPE_STATUS_BAR
143 * @see #TYPE_SEARCH_BAR
144 * @see #TYPE_PHONE
145 * @see #TYPE_SYSTEM_ALERT
146 * @see #TYPE_KEYGUARD
147 * @see #TYPE_TOAST
148 * @see #TYPE_SYSTEM_OVERLAY
149 * @see #TYPE_PRIORITY_PHONE
150 * @see #TYPE_STATUS_BAR_PANEL
151 * @see #TYPE_SYSTEM_DIALOG
152 * @see #TYPE_KEYGUARD_DIALOG
153 * @see #TYPE_SYSTEM_ERROR
154 * @see #TYPE_INPUT_METHOD
155 * @see #TYPE_INPUT_METHOD_DIALOG
156 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700157 @ViewDebug.ExportedProperty(mapping = {
158 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
159 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
160 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
161 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
162 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
163 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
164 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700165 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700166 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
167 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
168 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
169 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
170 @ViewDebug.IntToString(from = TYPE_KEYGUARD, to = "TYPE_KEYGUARD"),
171 @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
172 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
173 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700174 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"),
175 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
176 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
177 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
Jeff Brown3b2b3542010-10-15 00:54:27 -0700178 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700179 @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
180 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700181 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700182 @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
183 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
184 @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
185 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
186 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700187 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
188 @ViewDebug.IntToString(from = TYPE_HIDDEN_NAV_CONSUMER, to = "TYPE_HIDDEN_NAV_CONSUMER"),
189 @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
190 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL")
Joe Onorato8f2bd432010-03-25 11:45:28 -0700191 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800192 public int type;
193
194 /**
195 * Start of window types that represent normal application windows.
196 */
197 public static final int FIRST_APPLICATION_WINDOW = 1;
198
199 /**
200 * Window type: an application window that serves as the "base" window
201 * of the overall application; all other application windows will
202 * appear on top of it.
203 */
204 public static final int TYPE_BASE_APPLICATION = 1;
205
206 /**
207 * Window type: a normal application window. The {@link #token} must be
208 * an Activity token identifying who the window belongs to.
209 */
210 public static final int TYPE_APPLICATION = 2;
211
212 /**
213 * Window type: special application window that is displayed while the
214 * application is starting. Not for use by applications themselves;
215 * this is used by the system to display something until the
216 * application can show its own windows.
217 */
218 public static final int TYPE_APPLICATION_STARTING = 3;
219
220 /**
221 * End of types of application windows.
222 */
223 public static final int LAST_APPLICATION_WINDOW = 99;
224
225 /**
226 * Start of types of sub-windows. The {@link #token} of these windows
227 * must be set to the window they are attached to. These types of
228 * windows are kept next to their attached window in Z-order, and their
229 * coordinate space is relative to their attached window.
230 */
231 public static final int FIRST_SUB_WINDOW = 1000;
232
233 /**
234 * Window type: a panel on top of an application window. These windows
235 * appear on top of their attached window.
236 */
237 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
238
239 /**
240 * Window type: window for showing media (e.g. video). These windows
241 * are displayed behind their attached window.
242 */
243 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1;
244
245 /**
246 * Window type: a sub-panel on top of an application window. These
247 * windows are displayed on top their attached window and any
248 * {@link #TYPE_APPLICATION_PANEL} panels.
249 */
250 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW+2;
251
252 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
253 * of the window happens as that of a top-level window, <em>not</em>
254 * as a child of its container.
255 */
256 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3;
257
258 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700259 * Window type: window for showing overlays on top of media windows.
260 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
261 * application window. They should be translucent to be useful. This
262 * is a big ugly hack so:
263 * @hide
264 */
265 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4;
266
267 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800268 * End of types of sub-windows.
269 */
270 public static final int LAST_SUB_WINDOW = 1999;
271
272 /**
273 * Start of system-specific window types. These are not normally
274 * created by applications.
275 */
276 public static final int FIRST_SYSTEM_WINDOW = 2000;
277
278 /**
279 * Window type: the status bar. There can be only one status bar
280 * window; it is placed at the top of the screen, and all other
281 * windows are shifted down so they are below it.
282 */
283 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
284
285 /**
286 * Window type: the search bar. There can be only one search bar
287 * window; it is placed at the top of the screen.
288 */
289 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
290
291 /**
292 * Window type: phone. These are non-application windows providing
293 * user interaction with the phone (in particular incoming calls).
294 * These windows are normally placed above all applications, but behind
295 * the status bar.
296 */
297 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
298
299 /**
300 * Window type: system window, such as low power alert. These windows
301 * are always on top of application windows.
302 */
303 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
304
305 /**
306 * Window type: keyguard window.
307 */
308 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
309
310 /**
311 * Window type: transient notifications.
312 */
313 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
314
315 /**
316 * Window type: system overlay windows, which need to be displayed
317 * on top of everything else. These windows must not take input
318 * focus, or they will interfere with the keyguard.
319 */
320 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
321
322 /**
323 * Window type: priority phone UI, which needs to be displayed even if
324 * the keyguard is active. These windows must not take input
325 * focus, or they will interfere with the keyguard.
326 */
327 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
328
329 /**
330 * Window type: panel that slides out from the status bar
331 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800332 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
333
334 /**
335 * Window type: dialogs that the keyguard shows
336 */
337 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
338
339 /**
340 * Window type: internal system error windows, appear on top of
341 * everything they can.
342 */
343 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
344
345 /**
346 * Window type: internal input methods windows, which appear above
347 * the normal UI. Application windows may be resized or panned to keep
348 * the input focus visible while this window is displayed.
349 */
350 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
351
352 /**
353 * Window type: internal input methods dialog windows, which appear above
354 * the current input method window.
355 */
356 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
357
358 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700359 * Window type: wallpaper window, placed behind any window that wants
360 * to sit on top of the wallpaper.
361 */
362 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
363
364 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800365 * Window type: panel that slides out from over the status bar
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800366 */
367 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700368
369 /**
370 * Window type: secure system overlay windows, which need to be displayed
371 * on top of everything else. These windows must not take input
372 * focus, or they will interfere with the keyguard.
373 *
374 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
375 * system itself is allowed to create these overlays. Applications cannot
376 * obtain permission to create secure system overlays.
377 * @hide
378 */
379 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
380
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800381 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700382 * Window type: the drag-and-drop pseudowindow. There is only one
383 * drag layer (at most), and it is placed on top of all other windows.
384 * @hide
385 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700386 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700387
388 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800389 * Window type: panel that slides out from under the status bar
Joe Onoratoa89e9032010-11-24 11:13:44 -0800390 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800391 */
392 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
393
Jeff Brown83c09682010-12-23 17:50:18 -0800394 /**
395 * Window type: (mouse) pointer
396 * @hide
397 */
398 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800399
400 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400401 * Window type: Navigation bar (when distinct from status bar)
402 * @hide
403 */
404 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
405
406 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700407 * Window type: The volume level overlay/dialog shown when the user
408 * changes the system volume.
409 * @hide
410 */
411 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
412
413 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700414 * Window type: The boot progress dialog, goes on top of everything
415 * in the world.
416 * @hide
417 */
418 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
419
420 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700421 * Window type: Fake window to consume touch events when the navigation
422 * bar is hidden.
423 * @hide
424 */
425 public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22;
426
427 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500428 * Window type: Dreams (screen saver) window, just above keyguard.
429 * @hide
430 */
431 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
432
433 /**
Jim Millere898ac52012-04-06 17:10:57 -0700434 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
435 * @hide
436 */
437 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
438
439 /**
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700440 * Window type: Behind the universe of the real windows.
441 * @hide
442 */
443 public static final int TYPE_UNIVERSE_BACKGROUND = FIRST_SYSTEM_WINDOW+25;
444
445 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800446 * End of types of system windows.
447 */
448 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800449
Mathias Agopiand2112302010-12-07 19:38:17 -0800450 /** @deprecated this is ignored, this value is set automatically when needed. */
451 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800452 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800453 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700454 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800455 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800456 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700457 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800458 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800459 /** @deprecated this is ignored, this value is set automatically when needed. */
460 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800461 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700462
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800463 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700464 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800465 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700466 @Deprecated
467 public int memoryType;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800468
Mike Lockwoodef731622010-01-27 17:51:34 -0500469 /** Window flag: as long as this window is visible to the user, allow
470 * the lock screen to activate while the screen is on.
471 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800472 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500473 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
474
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800475 /** Window flag: everything behind this window will be dimmed.
476 * Use {@link #dimAmount} to control the amount of dim. */
477 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700478
479 /** Window flag: blur everything behind this window.
480 * @deprecated Blurring is no longer supported. */
481 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800482 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700483
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800484 /** Window flag: this window won't ever get key input focus, so the
485 * user can not send key or other button events to it. Those will
486 * instead go to whatever focusable window is behind it. This flag
487 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
488 * is explicitly set.
489 *
490 * <p>Setting this flag also implies that the window will not need to
491 * interact with
492 * a soft input method, so it will be Z-ordered and positioned
493 * independently of any active input method (typically this means it
494 * gets Z-ordered on top of the input method, so it can use the full
495 * screen for its content and cover the input method if needed. You
496 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
497 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
498
499 /** Window flag: this window can never receive touch events. */
500 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
501
502 /** Window flag: Even when this window is focusable (its
503 * {@link #FLAG_NOT_FOCUSABLE is not set), allow any pointer events
504 * outside of the window to be sent to the windows behind it. Otherwise
505 * it will consume all pointer events itself, regardless of whether they
506 * are inside of the window. */
507 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
508
509 /** Window flag: When set, if the device is asleep when the touch
510 * screen is pressed, you will receive this first touch event. Usually
511 * the first touch event is consumed by the system since the user can
512 * not see what they are pressing on.
513 */
514 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
515
516 /** Window flag: as long as this window is visible to the user, keep
517 * the device's screen turned on and bright. */
518 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
519
520 /** Window flag: place the window within the entire screen, ignoring
521 * decorations around the border (a.k.a. the status bar). The
522 * window must correctly position its contents to take the screen
523 * decoration into account. This flag is normally set for you
524 * by Window as described in {@link Window#setFlags}. */
525 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
526
527 /** Window flag: allow window to extend outside of the screen. */
528 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
529
530 /** Window flag: Hide all screen decorations (e.g. status bar) while
531 * this window is displayed. This allows the window to use the entire
532 * display space for itself -- the status bar will be hidden when
533 * an app window with this flag set is on the top layer. */
534 public static final int FLAG_FULLSCREEN = 0x00000400;
535
536 /** Window flag: Override {@link #FLAG_FULLSCREEN and force the
537 * screen decorations (such as status bar) to be shown. */
538 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
539
540 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700541 * the screen.
542 * @deprecated This flag is no longer used. */
543 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800544 public static final int FLAG_DITHER = 0x00001000;
545
546 /** Window flag: don't allow screen shots while this window is
Glenn Kastend6f5bde2011-01-19 15:27:27 -0800547 * displayed. Maps to Surface.SECURE. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800548 public static final int FLAG_SECURE = 0x00002000;
549
550 /** Window flag: a special mode where the layout parameters are used
551 * to perform scaling of the surface when it is composited to the
552 * screen. */
553 public static final int FLAG_SCALED = 0x00004000;
554
555 /** Window flag: intended for windows that will often be used when the user is
556 * holding the screen against their face, it will aggressively filter the event
557 * stream to prevent unintended presses in this situation that may not be
558 * desired for a particular window, when such an event stream is detected, the
559 * application will receive a CANCEL motion event to indicate this so applications
560 * can handle this accordingly by taking no action on the event
561 * until the finger is released. */
562 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
563
564 /** Window flag: a special option only for use in combination with
565 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
566 * screen your window may appear on top of or behind screen decorations
567 * such as the status bar. By also including this flag, the window
568 * manager will report the inset rectangle needed to ensure your
569 * content is not covered by screen decorations. This flag is normally
570 * set for you by Window as described in {@link Window#setFlags}.*/
571 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
572
573 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
574 * respect to how this window interacts with the current method. That
575 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
576 * window will behave as if it needs to interact with the input method
577 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
578 * not set and this flag is set, then the window will behave as if it
579 * doesn't need to interact with the input method and can be placed
580 * to use more space and cover the input method.
581 */
582 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
583
584 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
585 * can set this flag to receive a single special MotionEvent with
586 * the action
587 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
588 * touches that occur outside of your window. Note that you will not
589 * receive the full down/move/up gesture, only the location of the
590 * first down as an ACTION_OUTSIDE.
591 */
592 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
593
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700594 /** Window flag: special flag to let windows be shown when the screen
595 * is locked. This will let application windows take precedence over
596 * key guard or any other lock screens. Can be used with
597 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700598 * directly before showing the key guard window. Can be used with
599 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
600 * non-secure keyguards. This flag only applies to the top-most
601 * full-screen window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700602 */
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700603 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
604
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700605 /** Window flag: ask that the system wallpaper be shown behind
606 * your window. The window surface must be translucent to be able
607 * to actually see the wallpaper behind it; this flag just ensures
608 * that the wallpaper surface will be there if this window actually
609 * has translucent regions.
610 */
611 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
612
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700613 /** Window flag: when set as a window is being added or made
614 * visible, once the window has been shown then the system will
615 * poke the power manager's user activity (as if the user had woken
616 * up the device) to turn the screen on. */
617 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
618
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700619 /** Window flag: when set the window will cause the keyguard to
620 * be dismissed, only if it is not a secure lock keyguard. Because such
621 * a keyguard is not needed for security, it will never re-appear if
622 * the user navigates to another window (in contrast to
623 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
624 * hide both secure and non-secure keyguards but ensure they reappear
625 * when the user moves to another UI that doesn't hide them).
626 * If the keyguard is currently active and is secure (requires an
627 * unlock pattern) than the user will still need to confirm it before
628 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
Daniel Sandlerae069f72010-06-17 21:56:26 -0400629 * also been set.
630 */
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700631 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
Jeff Brown01ce2e92010-09-26 22:20:12 -0700632
633 /** Window flag: when set the window will accept for touch events
634 * outside of its bounds to be sent to other windows that also
635 * support split touch. When this flag is not set, the first pointer
636 * that goes down determines the window to which all subsequent touches
637 * go until all pointers go up. When this flag is set, each pointer
638 * (not necessarily the first) that goes down determines the window
639 * to which all subsequent touches of that pointer will go until that
640 * pointer goes up thereby enabling touches with multiple pointers
641 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800642 */
Jeff Brown01ce2e92010-09-26 22:20:12 -0700643 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800644
645 /**
Romain Guy72f0a272011-01-09 16:01:46 -0800646 * <p>Indicates whether this window should be hardware accelerated.
647 * Requesting hardware acceleration does not guarantee it will happen.</p>
648 *
649 * <p>This flag can be controlled programmatically <em>only</em> to enable
650 * hardware acceleration. To enable hardware acceleration for a given
651 * window programmatically, do the following:</p>
652 *
653 * <pre>
654 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
655 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
656 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
657 * </pre>
658 *
659 * <p>It is important to remember that this flag <strong>must</strong>
660 * be set before setting the content view of your activity or dialog.</p>
661 *
662 * <p>This flag cannot be used to disable hardware acceleration after it
663 * was enabled in your manifest using
664 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
665 * and programmatically disable hardware acceleration (for automated testing
666 * for instance), make sure it is turned off in your manifest and enable it
667 * on your activity or dialog when you need it instead, using the method
668 * described above.</p>
669 *
670 * <p>This flag is automatically set by the system if the
671 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
672 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800673 */
674 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -0400675
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800676 // ----- HIDDEN FLAGS.
677 // These start at the high bit and go down.
Jeff Brown98db5fa2011-06-08 15:37:10 -0700678
679 /** Window flag: Enable touches to slide out of a window into neighboring
680 * windows in mid-gesture instead of being captured for the duration of
681 * the gesture.
682 *
683 * This flag changes the behavior of touch focus for this window only.
684 * Touches can slide out of the window but they cannot necessarily slide
685 * back in (unless the other window with touch focus permits it).
686 *
687 * {@hide}
688 */
689 public static final int FLAG_SLIPPERY = 0x04000000;
690
Daniel Sandlere02d8082010-10-08 15:13:22 -0400691 /**
692 * Flag for a window belonging to an activity that responds to {@link KeyEvent#KEYCODE_MENU}
693 * and therefore needs a Menu key. For devices where Menu is a physical button this flag is
694 * ignored, but on devices where the Menu key is drawn in software it may be hidden unless
695 * this flag is set.
696 *
697 * (Note that Action Bars, when available, are the preferred way to offer additional
698 * functions otherwise accessed via an options menu.)
699 *
700 * {@hide}
701 */
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800702 public static final int FLAG_NEEDS_MENU_KEY = 0x08000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -0400703
Mitsuru Oshima1ecf5d22009-07-06 17:20:38 -0700704 /** Window flag: special flag to limit the size of the window to be
705 * original size ([320x480] x density). Used to create window for applications
706 * running under compatibility mode.
707 *
708 * {@hide} */
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700709 public static final int FLAG_COMPATIBLE_WINDOW = 0x20000000;
Mitsuru Oshima1ecf5d22009-07-06 17:20:38 -0700710
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711 /** Window flag: a special option intended for system dialogs. When
712 * this flag is set, the window will demand focus unconditionally when
713 * it is created.
714 * {@hide} */
715 public static final int FLAG_SYSTEM_ERROR = 0x40000000;
716
717 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700718 * Various behavioral options/flags. Default is none.
719 *
720 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
721 * @see #FLAG_DIM_BEHIND
722 * @see #FLAG_NOT_FOCUSABLE
723 * @see #FLAG_NOT_TOUCHABLE
724 * @see #FLAG_NOT_TOUCH_MODAL
725 * @see #FLAG_TOUCHABLE_WHEN_WAKING
726 * @see #FLAG_KEEP_SCREEN_ON
727 * @see #FLAG_LAYOUT_IN_SCREEN
728 * @see #FLAG_LAYOUT_NO_LIMITS
729 * @see #FLAG_FULLSCREEN
730 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700731 * @see #FLAG_SECURE
732 * @see #FLAG_SCALED
733 * @see #FLAG_IGNORE_CHEEK_PRESSES
734 * @see #FLAG_LAYOUT_INSET_DECOR
735 * @see #FLAG_ALT_FOCUSABLE_IM
736 * @see #FLAG_WATCH_OUTSIDE_TOUCH
737 * @see #FLAG_SHOW_WHEN_LOCKED
738 * @see #FLAG_SHOW_WALLPAPER
739 * @see #FLAG_TURN_SCREEN_ON
740 * @see #FLAG_DISMISS_KEYGUARD
741 * @see #FLAG_SPLIT_TOUCH
742 * @see #FLAG_HARDWARE_ACCELERATED
743 */
744 @ViewDebug.ExportedProperty(flagMapping = {
745 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
746 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
747 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
748 name = "FLAG_DIM_BEHIND"),
749 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
750 name = "FLAG_BLUR_BEHIND"),
751 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
752 name = "FLAG_NOT_FOCUSABLE"),
753 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
754 name = "FLAG_NOT_TOUCHABLE"),
755 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
756 name = "FLAG_NOT_TOUCH_MODAL"),
757 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
758 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
759 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
760 name = "FLAG_KEEP_SCREEN_ON"),
761 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
762 name = "FLAG_LAYOUT_IN_SCREEN"),
763 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
764 name = "FLAG_LAYOUT_NO_LIMITS"),
765 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
766 name = "FLAG_FULLSCREEN"),
767 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
768 name = "FLAG_FORCE_NOT_FULLSCREEN"),
769 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
770 name = "FLAG_DITHER"),
771 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
772 name = "FLAG_SECURE"),
773 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
774 name = "FLAG_SCALED"),
775 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
776 name = "FLAG_IGNORE_CHEEK_PRESSES"),
777 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
778 name = "FLAG_LAYOUT_INSET_DECOR"),
779 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
780 name = "FLAG_ALT_FOCUSABLE_IM"),
781 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
782 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
783 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
784 name = "FLAG_SHOW_WHEN_LOCKED"),
785 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
786 name = "FLAG_SHOW_WALLPAPER"),
787 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
788 name = "FLAG_TURN_SCREEN_ON"),
789 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
790 name = "FLAG_DISMISS_KEYGUARD"),
791 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
792 name = "FLAG_SPLIT_TOUCH"),
793 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
794 name = "FLAG_HARDWARE_ACCELERATED")
795 })
796 public int flags;
797
798 /**
799 * If the window has requested hardware acceleration, but this is not
800 * allowed in the process it is in, then still render it as if it is
801 * hardware accelerated. This is used for the starting preview windows
802 * in the system process, which don't need to have the overhead of
803 * hardware acceleration (they are just a static rendering), but should
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900804 * be rendered as such to match the actual window of the app even if it
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700805 * is hardware accelerated.
806 * Even if the window isn't hardware accelerated, still do its rendering
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900807 * as if it was.
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700808 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
809 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
810 * is generally disabled. This flag must be specified in addition to
811 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
812 * windows.
813 *
814 * @hide
815 */
816 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
817
818 /**
819 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900820 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700821 * If certain parts of the UI that really do want to use hardware
822 * acceleration, this flag can be set to force it. This is basically
823 * for the lock screen. Anyone else using it, you are probably wrong.
824 *
825 * @hide
826 */
827 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
828
829 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -0700830 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900831 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -0700832 * them (they do not affect the wallpaper scrolling operation) by calling
833 * {@link
834 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
835 *
836 * @hide
837 */
838 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
839
840 /**
Dianne Hackborn73ab6a42011-12-13 11:16:23 -0800841 * This is set for a window that has explicitly specified its
842 * FLAG_NEEDS_MENU_KEY, so we know the value on this window is the
843 * appropriate one to use. If this is not set, we should look at
844 * windows behind it to determine the appropriate value.
845 *
846 * @hide
847 */
848 public static final int PRIVATE_FLAG_SET_NEEDS_MENU_KEY = 0x00000008;
849
850 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700851 * Control flags that are private to the platform.
852 * @hide
853 */
854 public int privateFlags;
855
856 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800857 * Given a particular set of window manager flags, determine whether
858 * such a window may be a target for an input method when it has
859 * focus. In particular, this checks the
860 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
861 * flags and returns true if the combination of the two corresponds
862 * to a window that needs to be behind the input method so that the
863 * user can type into it.
864 *
865 * @param flags The current window manager flags.
866 *
867 * @return Returns true if such a window should be behind/interact
868 * with an input method, false if not.
869 */
870 public static boolean mayUseInputMethod(int flags) {
871 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
872 case 0:
873 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
874 return true;
875 }
876 return false;
877 }
878
879 /**
880 * Mask for {@link #softInputMode} of the bits that determine the
881 * desired visibility state of the soft input area for this window.
882 */
883 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
884
885 /**
886 * Visibility state for {@link #softInputMode}: no state has been specified.
887 */
888 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
889
890 /**
891 * Visibility state for {@link #softInputMode}: please don't change the state of
892 * the soft input area.
893 */
894 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
895
896 /**
897 * Visibility state for {@link #softInputMode}: please hide any soft input
898 * area when normally appropriate (when the user is navigating
899 * forward to your window).
900 */
901 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
902
903 /**
904 * Visibility state for {@link #softInputMode}: please always hide any
905 * soft input area when this window receives focus.
906 */
907 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
908
909 /**
910 * Visibility state for {@link #softInputMode}: please show the soft
911 * input area when normally appropriate (when the user is navigating
912 * forward to your window).
913 */
914 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
915
916 /**
917 * Visibility state for {@link #softInputMode}: please always make the
918 * soft input area visible when this window receives input focus.
919 */
920 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
921
922 /**
923 * Mask for {@link #softInputMode} of the bits that determine the
924 * way that the window should be adjusted to accommodate the soft
925 * input window.
926 */
927 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
928
929 /** Adjustment option for {@link #softInputMode}: nothing specified.
930 * The system will try to pick one or
931 * the other depending on the contents of the window.
932 */
933 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
934
935 /** Adjustment option for {@link #softInputMode}: set to allow the
936 * window to be resized when an input
937 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -0700938 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800939 * {@link #SOFT_INPUT_ADJUST_PAN}; if
940 * neither of these are set, then the system will try to pick one or
941 * the other depending on the contents of the window.
942 */
943 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
944
945 /** Adjustment option for {@link #softInputMode}: set to have a window
946 * pan when an input method is
947 * shown, so it doesn't need to deal with resizing but just panned
948 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -0700949 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 * neither of these are set, then the system will try to pick one or
951 * the other depending on the contents of the window.
952 */
953 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
954
Dianne Hackborndea3ef72010-10-28 14:24:22 -0700955 /** Adjustment option for {@link #softInputMode}: set to have a window
956 * not adjust for a shown input method. The window will not be resized,
957 * and it will not be panned to make its focus visible.
958 */
959 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
960
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800961 /**
962 * Bit for {@link #softInputMode}: set when the user has navigated
963 * forward to the window. This is normally set automatically for
964 * you by the system, though you may want to set it in certain cases
965 * when you are displaying a window yourself. This flag will always
966 * be cleared automatically after the window is displayed.
967 */
968 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -0500969
970 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -0800971 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800972 * of:
973 *
974 * <ul>
975 * <li> One of the visibility states
976 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
977 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or
978 * {@link #SOFT_INPUT_STATE_VISIBLE}.
979 * <li> One of the adjustment options
980 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},
981 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or
982 * {@link #SOFT_INPUT_ADJUST_PAN}.
983 */
984 public int softInputMode;
985
986 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -0700987 * Placement of window within the screen as per {@link Gravity}. Both
988 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
989 * android.graphics.Rect) Gravity.apply} and
990 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
991 * Gravity.applyDisplay} are used during window layout, with this value
992 * given as the desired gravity. For example you can specify
993 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
994 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
995 * to control the behavior of
996 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
997 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800998 *
999 * @see Gravity
1000 */
1001 public int gravity;
1002
1003 /**
1004 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001005 * between the container and the widget. See
1006 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1007 * android.graphics.Rect) Gravity.apply} for how this is used. This
1008 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001009 */
1010 public float horizontalMargin;
1011
1012 /**
1013 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001014 * between the container and the widget. See
1015 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1016 * android.graphics.Rect) Gravity.apply} for how this is used. This
1017 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001018 */
1019 public float verticalMargin;
1020
1021 /**
1022 * The desired bitmap format. May be one of the constants in
1023 * {@link android.graphics.PixelFormat}. Default is OPAQUE.
1024 */
1025 public int format;
1026
1027 /**
1028 * A style resource defining the animations to use for this window.
1029 * This must be a system resource; it can not be an application resource
1030 * because the window manager does not have access to applications.
1031 */
1032 public int windowAnimations;
1033
1034 /**
1035 * An alpha value to apply to this entire window.
1036 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1037 */
1038 public float alpha = 1.0f;
1039
1040 /**
1041 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1042 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1043 * dim.
1044 */
1045 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001046
1047 /**
1048 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1049 * indicating that the brightness value is not overridden for this window
1050 * and normal brightness policy should be used.
1051 */
1052 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1053
1054 /**
1055 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1056 * indicating that the screen or button backlight brightness should be set
1057 * to the lowest value when this window is in front.
1058 */
1059 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1060
1061 /**
1062 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1063 * indicating that the screen or button backlight brightness should be set
1064 * to the hightest value when this window is in front.
1065 */
1066 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001067
1068 /**
1069 * This can be used to override the user's preferred brightness of
1070 * the screen. A value of less than 0, the default, means to use the
1071 * preferred screen brightness. 0 to 1 adjusts the brightness from
1072 * dark to full bright.
1073 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001074 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001075
1076 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001077 * This can be used to override the standard behavior of the button and
1078 * keyboard backlights. A value of less than 0, the default, means to
1079 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1080 * from dark to full bright.
1081 */
1082 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1083
1084 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001085 * Identifier for this window. This will usually be filled in for
1086 * you.
1087 */
1088 public IBinder token = null;
1089
1090 /**
1091 * Name of the package owning this window.
1092 */
1093 public String packageName = null;
1094
1095 /**
1096 * Specific orientation value for a window.
1097 * May be any of the same values allowed
1098 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1099 * If not set, a default value of
1100 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
1101 * will be used.
1102 */
1103 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001104
1105 /**
1106 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001107 *
1108 * @see View#STATUS_BAR_VISIBLE
1109 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001110 */
1111 public int systemUiVisibility;
1112
1113 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001114 * @hide
1115 * The ui visibility as requested by the views in this hierarchy.
1116 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1117 */
1118 public int subtreeSystemUiVisibility;
1119
1120 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001121 * Get callbacks about the system ui visibility changing.
1122 *
1123 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1124 *
1125 * @hide
1126 */
1127 public boolean hasSystemUiListeners;
1128
Jeff Brown474dcb52011-06-14 20:22:50 -07001129 /**
1130 * When this window has focus, disable touch pad pointer gesture processing.
1131 * The window will receive raw position updates from the touch pad instead
1132 * of pointer movements and synthetic touch events.
1133 *
1134 * @hide
1135 */
1136 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1137
1138 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001139 * Does not construct an input channel for this window. The channel will therefore
1140 * be incapable of receiving input.
1141 *
1142 * @hide
1143 */
1144 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1145
1146 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001147 * Control special features of the input subsystem.
1148 *
1149 * @see #INPUT_FEATURE_DISABLE_TOUCH_PAD_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001150 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown474dcb52011-06-14 20:22:50 -07001151 * @hide
1152 */
1153 public int inputFeatures;
1154
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001155 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001156 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001157 type = TYPE_APPLICATION;
1158 format = PixelFormat.OPAQUE;
1159 }
1160
1161 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001162 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001163 type = _type;
1164 format = PixelFormat.OPAQUE;
1165 }
1166
1167 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001168 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001169 type = _type;
1170 flags = _flags;
1171 format = PixelFormat.OPAQUE;
1172 }
1173
1174 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08001175 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001176 type = _type;
1177 flags = _flags;
1178 format = _format;
1179 }
1180
1181 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
1182 super(w, h);
1183 type = _type;
1184 flags = _flags;
1185 format = _format;
1186 }
1187
1188 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
1189 int _flags, int _format) {
1190 super(w, h);
1191 x = xpos;
1192 y = ypos;
1193 type = _type;
1194 flags = _flags;
1195 format = _format;
1196 }
1197
1198 public final void setTitle(CharSequence title) {
1199 if (null == title)
1200 title = "";
1201
1202 mTitle = TextUtils.stringOrSpannedString(title);
1203 }
1204
1205 public final CharSequence getTitle() {
1206 return mTitle;
1207 }
1208
1209 public int describeContents() {
1210 return 0;
1211 }
1212
1213 public void writeToParcel(Parcel out, int parcelableFlags) {
1214 out.writeInt(width);
1215 out.writeInt(height);
1216 out.writeInt(x);
1217 out.writeInt(y);
1218 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001219 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001220 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001221 out.writeInt(softInputMode);
1222 out.writeInt(gravity);
1223 out.writeFloat(horizontalMargin);
1224 out.writeFloat(verticalMargin);
1225 out.writeInt(format);
1226 out.writeInt(windowAnimations);
1227 out.writeFloat(alpha);
1228 out.writeFloat(dimAmount);
1229 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001230 out.writeFloat(buttonBrightness);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 out.writeStrongBinder(token);
1232 out.writeString(packageName);
1233 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
1234 out.writeInt(screenOrientation);
Joe Onorato664644d2011-01-23 17:53:23 -08001235 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08001236 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08001237 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07001238 out.writeInt(inputFeatures);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001239 }
1240
1241 public static final Parcelable.Creator<LayoutParams> CREATOR
1242 = new Parcelable.Creator<LayoutParams>() {
1243 public LayoutParams createFromParcel(Parcel in) {
1244 return new LayoutParams(in);
1245 }
1246
1247 public LayoutParams[] newArray(int size) {
1248 return new LayoutParams[size];
1249 }
1250 };
1251
1252
1253 public LayoutParams(Parcel in) {
1254 width = in.readInt();
1255 height = in.readInt();
1256 x = in.readInt();
1257 y = in.readInt();
1258 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001259 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001260 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001261 softInputMode = in.readInt();
1262 gravity = in.readInt();
1263 horizontalMargin = in.readFloat();
1264 verticalMargin = in.readFloat();
1265 format = in.readInt();
1266 windowAnimations = in.readInt();
1267 alpha = in.readFloat();
1268 dimAmount = in.readFloat();
1269 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001270 buttonBrightness = in.readFloat();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 token = in.readStrongBinder();
1272 packageName = in.readString();
1273 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
1274 screenOrientation = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001275 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08001276 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001277 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07001278 inputFeatures = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001279 }
1280
Romain Guy72998072009-06-22 11:09:20 -07001281 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001282 public static final int LAYOUT_CHANGED = 1<<0;
1283 public static final int TYPE_CHANGED = 1<<1;
1284 public static final int FLAGS_CHANGED = 1<<2;
1285 public static final int FORMAT_CHANGED = 1<<3;
1286 public static final int ANIMATION_CHANGED = 1<<4;
1287 public static final int DIM_AMOUNT_CHANGED = 1<<5;
1288 public static final int TITLE_CHANGED = 1<<6;
1289 public static final int ALPHA_CHANGED = 1<<7;
1290 public static final int MEMORY_TYPE_CHANGED = 1<<8;
1291 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
1292 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
1293 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001294 /** {@hide} */
1295 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<12;
Joe Onorato664644d2011-01-23 17:53:23 -08001296 /** {@hide} */
1297 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<13;
1298 /** {@hide} */
1299 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<14;
Jeff Brown474dcb52011-06-14 20:22:50 -07001300 /** {@hide} */
1301 public static final int INPUT_FEATURES_CHANGED = 1<<15;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001302 /** {@hide} */
1303 public static final int PRIVATE_FLAGS_CHANGED = 1<<16;
Romain Guyf21c9b02011-09-06 16:56:54 -07001304 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07001305 public static final int EVERYTHING_CHANGED = 0xffffffff;
1306
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001307 // internal buffer to backup/restore parameters under compatibility mode.
1308 private int[] mCompatibilityParamsBackup = null;
1309
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001310 public final int copyFrom(LayoutParams o) {
1311 int changes = 0;
1312
1313 if (width != o.width) {
1314 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07001315 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001316 }
1317 if (height != o.height) {
1318 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07001319 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001320 }
1321 if (x != o.x) {
1322 x = o.x;
1323 changes |= LAYOUT_CHANGED;
1324 }
1325 if (y != o.y) {
1326 y = o.y;
1327 changes |= LAYOUT_CHANGED;
1328 }
1329 if (horizontalWeight != o.horizontalWeight) {
1330 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001331 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001332 }
1333 if (verticalWeight != o.verticalWeight) {
1334 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001335 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 }
1337 if (horizontalMargin != o.horizontalMargin) {
1338 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001339 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001340 }
1341 if (verticalMargin != o.verticalMargin) {
1342 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001343 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001344 }
1345 if (type != o.type) {
1346 type = o.type;
1347 changes |= TYPE_CHANGED;
1348 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001349 if (flags != o.flags) {
1350 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07001351 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001352 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001353 if (privateFlags != o.privateFlags) {
1354 privateFlags = o.privateFlags;
1355 changes |= PRIVATE_FLAGS_CHANGED;
1356 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001357 if (softInputMode != o.softInputMode) {
1358 softInputMode = o.softInputMode;
1359 changes |= SOFT_INPUT_MODE_CHANGED;
1360 }
1361 if (gravity != o.gravity) {
1362 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07001363 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001364 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001365 if (format != o.format) {
1366 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07001367 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 }
1369 if (windowAnimations != o.windowAnimations) {
1370 windowAnimations = o.windowAnimations;
1371 changes |= ANIMATION_CHANGED;
1372 }
1373 if (token == null) {
1374 // NOTE: token only copied if the recipient doesn't
1375 // already have one.
1376 token = o.token;
1377 }
1378 if (packageName == null) {
1379 // NOTE: packageName only copied if the recipient doesn't
1380 // already have one.
1381 packageName = o.packageName;
1382 }
1383 if (!mTitle.equals(o.mTitle)) {
1384 mTitle = o.mTitle;
1385 changes |= TITLE_CHANGED;
1386 }
1387 if (alpha != o.alpha) {
1388 alpha = o.alpha;
1389 changes |= ALPHA_CHANGED;
1390 }
1391 if (dimAmount != o.dimAmount) {
1392 dimAmount = o.dimAmount;
1393 changes |= DIM_AMOUNT_CHANGED;
1394 }
1395 if (screenBrightness != o.screenBrightness) {
1396 screenBrightness = o.screenBrightness;
1397 changes |= SCREEN_BRIGHTNESS_CHANGED;
1398 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001399 if (buttonBrightness != o.buttonBrightness) {
1400 buttonBrightness = o.buttonBrightness;
1401 changes |= BUTTON_BRIGHTNESS_CHANGED;
1402 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001403
1404 if (screenOrientation != o.screenOrientation) {
1405 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07001406 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001407 }
Romain Guy529b60a2010-08-03 18:05:47 -07001408
Joe Onorato14782f72011-01-25 19:53:17 -08001409 if (systemUiVisibility != o.systemUiVisibility
1410 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08001411 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08001412 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08001413 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
1414 }
1415
1416 if (hasSystemUiListeners != o.hasSystemUiListeners) {
1417 hasSystemUiListeners = o.hasSystemUiListeners;
1418 changes |= SYSTEM_UI_LISTENER_CHANGED;
1419 }
1420
Jeff Brown474dcb52011-06-14 20:22:50 -07001421 if (inputFeatures != o.inputFeatures) {
1422 inputFeatures = o.inputFeatures;
1423 changes |= INPUT_FEATURES_CHANGED;
1424 }
1425
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001426 return changes;
1427 }
1428
1429 @Override
1430 public String debug(String output) {
1431 output += "Contents of " + this + ":";
1432 Log.d("Debug", output);
1433 output = super.debug("");
1434 Log.d("Debug", output);
1435 Log.d("Debug", "");
1436 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
1437 return "";
1438 }
1439
1440 @Override
1441 public String toString() {
1442 StringBuilder sb = new StringBuilder(256);
1443 sb.append("WM.LayoutParams{");
1444 sb.append("(");
1445 sb.append(x);
1446 sb.append(',');
1447 sb.append(y);
1448 sb.append(")(");
Romain Guy980a9382010-01-08 15:06:28 -08001449 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001450 sb.append('x');
Romain Guy980a9382010-01-08 15:06:28 -08001451 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001452 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001453 if (horizontalMargin != 0) {
1454 sb.append(" hm=");
1455 sb.append(horizontalMargin);
1456 }
1457 if (verticalMargin != 0) {
1458 sb.append(" vm=");
1459 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001460 }
1461 if (gravity != 0) {
1462 sb.append(" gr=#");
1463 sb.append(Integer.toHexString(gravity));
1464 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001465 if (softInputMode != 0) {
1466 sb.append(" sim=#");
1467 sb.append(Integer.toHexString(softInputMode));
1468 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001469 sb.append(" ty=");
1470 sb.append(type);
1471 sb.append(" fl=#");
1472 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001473 if (privateFlags != 0) {
1474 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
1475 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001476 if (format != PixelFormat.OPAQUE) {
1477 sb.append(" fmt=");
1478 sb.append(format);
1479 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001480 if (windowAnimations != 0) {
1481 sb.append(" wanim=0x");
1482 sb.append(Integer.toHexString(windowAnimations));
1483 }
1484 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
1485 sb.append(" or=");
1486 sb.append(screenOrientation);
1487 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001488 if (alpha != 1.0f) {
1489 sb.append(" alpha=");
1490 sb.append(alpha);
1491 }
1492 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1493 sb.append(" sbrt=");
1494 sb.append(screenBrightness);
1495 }
1496 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1497 sb.append(" bbrt=");
1498 sb.append(buttonBrightness);
1499 }
Mitsuru Oshima5a2b91d2009-07-16 16:30:02 -07001500 if ((flags & FLAG_COMPATIBLE_WINDOW) != 0) {
1501 sb.append(" compatible=true");
1502 }
Joe Onorato664644d2011-01-23 17:53:23 -08001503 if (systemUiVisibility != 0) {
1504 sb.append(" sysui=0x");
1505 sb.append(Integer.toHexString(systemUiVisibility));
1506 }
Joe Onorato14782f72011-01-25 19:53:17 -08001507 if (subtreeSystemUiVisibility != 0) {
1508 sb.append(" vsysui=0x");
1509 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
1510 }
Joe Onorato664644d2011-01-23 17:53:23 -08001511 if (hasSystemUiListeners) {
1512 sb.append(" sysuil=");
1513 sb.append(hasSystemUiListeners);
1514 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001515 if (inputFeatures != 0) {
1516 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
1517 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001518 sb.append('}');
1519 return sb.toString();
1520 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001521
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001522 /**
1523 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001524 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001525 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001526 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001527 x = (int) (x * scale + 0.5f);
1528 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001529 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001530 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001531 }
1532 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07001533 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07001534 }
1535 }
1536
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001537 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001538 * Backup the layout parameters used in compatibility mode.
1539 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001540 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001541 void backup() {
1542 int[] backup = mCompatibilityParamsBackup;
1543 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07001544 // we backup 4 elements, x, y, width, height
1545 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001546 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001547 backup[0] = x;
1548 backup[1] = y;
1549 backup[2] = width;
1550 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001551 }
1552
1553 /**
1554 * Restore the layout params' coordinates, size and gravity
1555 * @see LayoutParams#backup()
1556 */
1557 void restore() {
1558 int[] backup = mCompatibilityParamsBackup;
1559 if (backup != null) {
1560 x = backup[0];
1561 y = backup[1];
1562 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07001563 height = backup[3];
1564 }
1565 }
1566
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001567 private CharSequence mTitle = "";
1568 }
1569}