The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.view; |
| 18 | |
| 19 | import android.content.pm.ActivityInfo; |
| 20 | import android.graphics.PixelFormat; |
| 21 | import android.os.IBinder; |
| 22 | import android.os.Parcel; |
| 23 | import android.os.Parcelable; |
| 24 | import android.text.TextUtils; |
| 25 | import 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 | */ |
| 36 | public 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 Hackborn | 7eec10e | 2010-11-12 18:03:47 -0800 | [diff] [blame] | 68 | /** |
| 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 76 | 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 Meglio | 9e3b002 | 2011-06-06 16:30:29 -0700 | [diff] [blame] | 80 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 82 | */ |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 83 | @ViewDebug.ExportedProperty |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 84 | 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 Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 91 | @ViewDebug.ExportedProperty |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 92 | 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 Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 100 | @ViewDebug.ExportedProperty |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 101 | 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 Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 109 | @ViewDebug.ExportedProperty |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 110 | public float verticalWeight; |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 111 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 112 | /** |
| 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 Onorato | 8f2bd43 | 2010-03-25 11:45:28 -0700 | [diff] [blame] | 157 | @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"), |
| 165 | @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"), |
| 166 | @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"), |
| 167 | @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"), |
| 168 | @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"), |
| 169 | @ViewDebug.IntToString(from = TYPE_KEYGUARD, to = "TYPE_KEYGUARD"), |
| 170 | @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"), |
| 171 | @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"), |
| 172 | @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"), |
| 173 | @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"), |
Joe Onorato | 29fc2c9 | 2010-11-24 10:26:50 -0800 | [diff] [blame] | 174 | @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"), |
Joe Onorato | 8f2bd43 | 2010-03-25 11:45:28 -0700 | [diff] [blame] | 175 | @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"), |
| 176 | @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"), |
| 177 | @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"), |
| 178 | @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"), |
Jeff Brown | 3b2b354 | 2010-10-15 00:54:27 -0700 | [diff] [blame] | 179 | @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"), |
Dianne Hackborn | 29aae6f | 2011-08-18 18:30:09 -0700 | [diff] [blame] | 180 | @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"), |
| 181 | @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS") |
Joe Onorato | 8f2bd43 | 2010-03-25 11:45:28 -0700 | [diff] [blame] | 182 | }) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 183 | public int type; |
| 184 | |
| 185 | /** |
| 186 | * Start of window types that represent normal application windows. |
| 187 | */ |
| 188 | public static final int FIRST_APPLICATION_WINDOW = 1; |
| 189 | |
| 190 | /** |
| 191 | * Window type: an application window that serves as the "base" window |
| 192 | * of the overall application; all other application windows will |
| 193 | * appear on top of it. |
| 194 | */ |
| 195 | public static final int TYPE_BASE_APPLICATION = 1; |
| 196 | |
| 197 | /** |
| 198 | * Window type: a normal application window. The {@link #token} must be |
| 199 | * an Activity token identifying who the window belongs to. |
| 200 | */ |
| 201 | public static final int TYPE_APPLICATION = 2; |
| 202 | |
| 203 | /** |
| 204 | * Window type: special application window that is displayed while the |
| 205 | * application is starting. Not for use by applications themselves; |
| 206 | * this is used by the system to display something until the |
| 207 | * application can show its own windows. |
| 208 | */ |
| 209 | public static final int TYPE_APPLICATION_STARTING = 3; |
| 210 | |
| 211 | /** |
| 212 | * End of types of application windows. |
| 213 | */ |
| 214 | public static final int LAST_APPLICATION_WINDOW = 99; |
| 215 | |
| 216 | /** |
| 217 | * Start of types of sub-windows. The {@link #token} of these windows |
| 218 | * must be set to the window they are attached to. These types of |
| 219 | * windows are kept next to their attached window in Z-order, and their |
| 220 | * coordinate space is relative to their attached window. |
| 221 | */ |
| 222 | public static final int FIRST_SUB_WINDOW = 1000; |
| 223 | |
| 224 | /** |
| 225 | * Window type: a panel on top of an application window. These windows |
| 226 | * appear on top of their attached window. |
| 227 | */ |
| 228 | public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW; |
| 229 | |
| 230 | /** |
| 231 | * Window type: window for showing media (e.g. video). These windows |
| 232 | * are displayed behind their attached window. |
| 233 | */ |
| 234 | public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1; |
| 235 | |
| 236 | /** |
| 237 | * Window type: a sub-panel on top of an application window. These |
| 238 | * windows are displayed on top their attached window and any |
| 239 | * {@link #TYPE_APPLICATION_PANEL} panels. |
| 240 | */ |
| 241 | public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW+2; |
| 242 | |
| 243 | /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout |
| 244 | * of the window happens as that of a top-level window, <em>not</em> |
| 245 | * as a child of its container. |
| 246 | */ |
| 247 | public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3; |
| 248 | |
| 249 | /** |
Dianne Hackborn | c4d5d02 | 2009-05-21 17:32:42 -0700 | [diff] [blame] | 250 | * Window type: window for showing overlays on top of media windows. |
| 251 | * These windows are displayed between TYPE_APPLICATION_MEDIA and the |
| 252 | * application window. They should be translucent to be useful. This |
| 253 | * is a big ugly hack so: |
| 254 | * @hide |
| 255 | */ |
| 256 | public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4; |
| 257 | |
| 258 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 259 | * End of types of sub-windows. |
| 260 | */ |
| 261 | public static final int LAST_SUB_WINDOW = 1999; |
| 262 | |
| 263 | /** |
| 264 | * Start of system-specific window types. These are not normally |
| 265 | * created by applications. |
| 266 | */ |
| 267 | public static final int FIRST_SYSTEM_WINDOW = 2000; |
| 268 | |
| 269 | /** |
| 270 | * Window type: the status bar. There can be only one status bar |
| 271 | * window; it is placed at the top of the screen, and all other |
| 272 | * windows are shifted down so they are below it. |
| 273 | */ |
| 274 | public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW; |
| 275 | |
| 276 | /** |
| 277 | * Window type: the search bar. There can be only one search bar |
| 278 | * window; it is placed at the top of the screen. |
| 279 | */ |
| 280 | public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1; |
| 281 | |
| 282 | /** |
| 283 | * Window type: phone. These are non-application windows providing |
| 284 | * user interaction with the phone (in particular incoming calls). |
| 285 | * These windows are normally placed above all applications, but behind |
| 286 | * the status bar. |
| 287 | */ |
| 288 | public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2; |
| 289 | |
| 290 | /** |
| 291 | * Window type: system window, such as low power alert. These windows |
| 292 | * are always on top of application windows. |
| 293 | */ |
| 294 | public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3; |
| 295 | |
| 296 | /** |
| 297 | * Window type: keyguard window. |
| 298 | */ |
| 299 | public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4; |
| 300 | |
| 301 | /** |
| 302 | * Window type: transient notifications. |
| 303 | */ |
| 304 | public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5; |
| 305 | |
| 306 | /** |
| 307 | * Window type: system overlay windows, which need to be displayed |
| 308 | * on top of everything else. These windows must not take input |
| 309 | * focus, or they will interfere with the keyguard. |
| 310 | */ |
| 311 | public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6; |
| 312 | |
| 313 | /** |
| 314 | * Window type: priority phone UI, which needs to be displayed even if |
| 315 | * the keyguard is active. These windows must not take input |
| 316 | * focus, or they will interfere with the keyguard. |
| 317 | */ |
| 318 | public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7; |
| 319 | |
| 320 | /** |
| 321 | * Window type: panel that slides out from the status bar |
| 322 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 323 | public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8; |
| 324 | |
| 325 | /** |
| 326 | * Window type: dialogs that the keyguard shows |
| 327 | */ |
| 328 | public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9; |
| 329 | |
| 330 | /** |
| 331 | * Window type: internal system error windows, appear on top of |
| 332 | * everything they can. |
| 333 | */ |
| 334 | public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10; |
| 335 | |
| 336 | /** |
| 337 | * Window type: internal input methods windows, which appear above |
| 338 | * the normal UI. Application windows may be resized or panned to keep |
| 339 | * the input focus visible while this window is displayed. |
| 340 | */ |
| 341 | public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11; |
| 342 | |
| 343 | /** |
| 344 | * Window type: internal input methods dialog windows, which appear above |
| 345 | * the current input method window. |
| 346 | */ |
| 347 | public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12; |
| 348 | |
| 349 | /** |
Dianne Hackborn | 4c62fc0 | 2009-08-08 20:40:27 -0700 | [diff] [blame] | 350 | * Window type: wallpaper window, placed behind any window that wants |
| 351 | * to sit on top of the wallpaper. |
| 352 | */ |
| 353 | public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13; |
| 354 | |
| 355 | /** |
Joe Onorato | 29fc2c9 | 2010-11-24 10:26:50 -0800 | [diff] [blame] | 356 | * Window type: panel that slides out from over the status bar |
Dianne Hackborn | badc47e | 2009-11-08 17:37:07 -0800 | [diff] [blame] | 357 | */ |
| 358 | public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14; |
Jeff Brown | 3b2b354 | 2010-10-15 00:54:27 -0700 | [diff] [blame] | 359 | |
| 360 | /** |
| 361 | * Window type: secure system overlay windows, which need to be displayed |
| 362 | * on top of everything else. These windows must not take input |
| 363 | * focus, or they will interfere with the keyguard. |
| 364 | * |
| 365 | * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the |
| 366 | * system itself is allowed to create these overlays. Applications cannot |
| 367 | * obtain permission to create secure system overlays. |
| 368 | * @hide |
| 369 | */ |
| 370 | public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15; |
| 371 | |
Dianne Hackborn | badc47e | 2009-11-08 17:37:07 -0800 | [diff] [blame] | 372 | /** |
Christopher Tate | a53146c | 2010-09-07 11:57:52 -0700 | [diff] [blame] | 373 | * Window type: the drag-and-drop pseudowindow. There is only one |
| 374 | * drag layer (at most), and it is placed on top of all other windows. |
| 375 | * @hide |
| 376 | */ |
Jeff Brown | 3b2b354 | 2010-10-15 00:54:27 -0700 | [diff] [blame] | 377 | public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16; |
Christopher Tate | a53146c | 2010-09-07 11:57:52 -0700 | [diff] [blame] | 378 | |
| 379 | /** |
Joe Onorato | 29fc2c9 | 2010-11-24 10:26:50 -0800 | [diff] [blame] | 380 | * Window type: panel that slides out from under the status bar |
Joe Onorato | a89e903 | 2010-11-24 11:13:44 -0800 | [diff] [blame] | 381 | * @hide |
Joe Onorato | 29fc2c9 | 2010-11-24 10:26:50 -0800 | [diff] [blame] | 382 | */ |
| 383 | public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17; |
| 384 | |
Jeff Brown | 83c0968 | 2010-12-23 17:50:18 -0800 | [diff] [blame] | 385 | /** |
| 386 | * Window type: (mouse) pointer |
| 387 | * @hide |
| 388 | */ |
| 389 | public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18; |
Joe Onorato | 29fc2c9 | 2010-11-24 10:26:50 -0800 | [diff] [blame] | 390 | |
| 391 | /** |
Daniel Sandler | 8956dbb | 2011-04-22 07:55:02 -0400 | [diff] [blame] | 392 | * Window type: Navigation bar (when distinct from status bar) |
| 393 | * @hide |
| 394 | */ |
| 395 | public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19; |
| 396 | |
| 397 | /** |
Dianne Hackborn | e8ecde1 | 2011-08-03 18:55:19 -0700 | [diff] [blame] | 398 | * Window type: The volume level overlay/dialog shown when the user |
| 399 | * changes the system volume. |
| 400 | * @hide |
| 401 | */ |
| 402 | public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20; |
| 403 | |
| 404 | /** |
Dianne Hackborn | 29aae6f | 2011-08-18 18:30:09 -0700 | [diff] [blame] | 405 | * Window type: The boot progress dialog, goes on top of everything |
| 406 | * in the world. |
| 407 | * @hide |
| 408 | */ |
| 409 | public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21; |
| 410 | |
| 411 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 412 | * End of types of system windows. |
| 413 | */ |
| 414 | public static final int LAST_SYSTEM_WINDOW = 2999; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 415 | |
Mathias Agopian | d211230 | 2010-12-07 19:38:17 -0800 | [diff] [blame] | 416 | /** @deprecated this is ignored, this value is set automatically when needed. */ |
| 417 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 418 | public static final int MEMORY_TYPE_NORMAL = 0; |
Mathias Agopian | d211230 | 2010-12-07 19:38:17 -0800 | [diff] [blame] | 419 | /** @deprecated this is ignored, this value is set automatically when needed. */ |
Mathias Agopian | 317a628 | 2009-08-13 17:29:02 -0700 | [diff] [blame] | 420 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 421 | public static final int MEMORY_TYPE_HARDWARE = 1; |
Mathias Agopian | d211230 | 2010-12-07 19:38:17 -0800 | [diff] [blame] | 422 | /** @deprecated this is ignored, this value is set automatically when needed. */ |
Mathias Agopian | 317a628 | 2009-08-13 17:29:02 -0700 | [diff] [blame] | 423 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 424 | public static final int MEMORY_TYPE_GPU = 2; |
Mathias Agopian | d211230 | 2010-12-07 19:38:17 -0800 | [diff] [blame] | 425 | /** @deprecated this is ignored, this value is set automatically when needed. */ |
| 426 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 427 | public static final int MEMORY_TYPE_PUSH_BUFFERS = 3; |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 428 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 429 | /** |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 430 | * @deprecated this is ignored |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 431 | */ |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 432 | @Deprecated |
| 433 | public int memoryType; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 434 | |
Mike Lockwood | ef73162 | 2010-01-27 17:51:34 -0500 | [diff] [blame] | 435 | /** Window flag: as long as this window is visible to the user, allow |
| 436 | * the lock screen to activate while the screen is on. |
| 437 | * This can be used independently, or in combination with |
Christopher Tate | 95f7850 | 2010-01-29 15:57:34 -0800 | [diff] [blame] | 438 | * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */ |
Mike Lockwood | ef73162 | 2010-01-27 17:51:34 -0500 | [diff] [blame] | 439 | public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001; |
| 440 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 441 | /** Window flag: everything behind this window will be dimmed. |
| 442 | * Use {@link #dimAmount} to control the amount of dim. */ |
| 443 | public static final int FLAG_DIM_BEHIND = 0x00000002; |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 444 | |
| 445 | /** Window flag: blur everything behind this window. |
| 446 | * @deprecated Blurring is no longer supported. */ |
| 447 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 448 | public static final int FLAG_BLUR_BEHIND = 0x00000004; |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 449 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 450 | /** Window flag: this window won't ever get key input focus, so the |
| 451 | * user can not send key or other button events to it. Those will |
| 452 | * instead go to whatever focusable window is behind it. This flag |
| 453 | * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that |
| 454 | * is explicitly set. |
| 455 | * |
| 456 | * <p>Setting this flag also implies that the window will not need to |
| 457 | * interact with |
| 458 | * a soft input method, so it will be Z-ordered and positioned |
| 459 | * independently of any active input method (typically this means it |
| 460 | * gets Z-ordered on top of the input method, so it can use the full |
| 461 | * screen for its content and cover the input method if needed. You |
| 462 | * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */ |
| 463 | public static final int FLAG_NOT_FOCUSABLE = 0x00000008; |
| 464 | |
| 465 | /** Window flag: this window can never receive touch events. */ |
| 466 | public static final int FLAG_NOT_TOUCHABLE = 0x00000010; |
| 467 | |
| 468 | /** Window flag: Even when this window is focusable (its |
| 469 | * {@link #FLAG_NOT_FOCUSABLE is not set), allow any pointer events |
| 470 | * outside of the window to be sent to the windows behind it. Otherwise |
| 471 | * it will consume all pointer events itself, regardless of whether they |
| 472 | * are inside of the window. */ |
| 473 | public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020; |
| 474 | |
| 475 | /** Window flag: When set, if the device is asleep when the touch |
| 476 | * screen is pressed, you will receive this first touch event. Usually |
| 477 | * the first touch event is consumed by the system since the user can |
| 478 | * not see what they are pressing on. |
| 479 | */ |
| 480 | public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040; |
| 481 | |
| 482 | /** Window flag: as long as this window is visible to the user, keep |
| 483 | * the device's screen turned on and bright. */ |
| 484 | public static final int FLAG_KEEP_SCREEN_ON = 0x00000080; |
| 485 | |
| 486 | /** Window flag: place the window within the entire screen, ignoring |
| 487 | * decorations around the border (a.k.a. the status bar). The |
| 488 | * window must correctly position its contents to take the screen |
| 489 | * decoration into account. This flag is normally set for you |
| 490 | * by Window as described in {@link Window#setFlags}. */ |
| 491 | public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100; |
| 492 | |
| 493 | /** Window flag: allow window to extend outside of the screen. */ |
| 494 | public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200; |
| 495 | |
| 496 | /** Window flag: Hide all screen decorations (e.g. status bar) while |
| 497 | * this window is displayed. This allows the window to use the entire |
| 498 | * display space for itself -- the status bar will be hidden when |
| 499 | * an app window with this flag set is on the top layer. */ |
| 500 | public static final int FLAG_FULLSCREEN = 0x00000400; |
| 501 | |
| 502 | /** Window flag: Override {@link #FLAG_FULLSCREEN and force the |
| 503 | * screen decorations (such as status bar) to be shown. */ |
| 504 | public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800; |
| 505 | |
| 506 | /** Window flag: turn on dithering when compositing this window to |
| 507 | * the screen. */ |
| 508 | public static final int FLAG_DITHER = 0x00001000; |
| 509 | |
| 510 | /** Window flag: don't allow screen shots while this window is |
Glenn Kasten | d6f5bde | 2011-01-19 15:27:27 -0800 | [diff] [blame] | 511 | * displayed. Maps to Surface.SECURE. */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 512 | public static final int FLAG_SECURE = 0x00002000; |
| 513 | |
| 514 | /** Window flag: a special mode where the layout parameters are used |
| 515 | * to perform scaling of the surface when it is composited to the |
| 516 | * screen. */ |
| 517 | public static final int FLAG_SCALED = 0x00004000; |
| 518 | |
| 519 | /** Window flag: intended for windows that will often be used when the user is |
| 520 | * holding the screen against their face, it will aggressively filter the event |
| 521 | * stream to prevent unintended presses in this situation that may not be |
| 522 | * desired for a particular window, when such an event stream is detected, the |
| 523 | * application will receive a CANCEL motion event to indicate this so applications |
| 524 | * can handle this accordingly by taking no action on the event |
| 525 | * until the finger is released. */ |
| 526 | public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000; |
| 527 | |
| 528 | /** Window flag: a special option only for use in combination with |
| 529 | * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the |
| 530 | * screen your window may appear on top of or behind screen decorations |
| 531 | * such as the status bar. By also including this flag, the window |
| 532 | * manager will report the inset rectangle needed to ensure your |
| 533 | * content is not covered by screen decorations. This flag is normally |
| 534 | * set for you by Window as described in {@link Window#setFlags}.*/ |
| 535 | public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000; |
| 536 | |
| 537 | /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with |
| 538 | * respect to how this window interacts with the current method. That |
| 539 | * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the |
| 540 | * window will behave as if it needs to interact with the input method |
| 541 | * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is |
| 542 | * not set and this flag is set, then the window will behave as if it |
| 543 | * doesn't need to interact with the input method and can be placed |
| 544 | * to use more space and cover the input method. |
| 545 | */ |
| 546 | public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000; |
| 547 | |
| 548 | /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you |
| 549 | * can set this flag to receive a single special MotionEvent with |
| 550 | * the action |
| 551 | * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for |
| 552 | * touches that occur outside of your window. Note that you will not |
| 553 | * receive the full down/move/up gesture, only the location of the |
| 554 | * first down as an ACTION_OUTSIDE. |
| 555 | */ |
| 556 | public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000; |
| 557 | |
Suchi Amalapurapu | d1a9337 | 2009-05-14 17:54:31 -0700 | [diff] [blame] | 558 | /** Window flag: special flag to let windows be shown when the screen |
| 559 | * is locked. This will let application windows take precedence over |
| 560 | * key guard or any other lock screens. Can be used with |
| 561 | * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 562 | * directly before showing the key guard window. Can be used with |
| 563 | * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss |
| 564 | * non-secure keyguards. This flag only applies to the top-most |
| 565 | * full-screen window. |
Dianne Hackborn | 4c62fc0 | 2009-08-08 20:40:27 -0700 | [diff] [blame] | 566 | */ |
Suchi Amalapurapu | d1a9337 | 2009-05-14 17:54:31 -0700 | [diff] [blame] | 567 | public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000; |
| 568 | |
Dianne Hackborn | 4c62fc0 | 2009-08-08 20:40:27 -0700 | [diff] [blame] | 569 | /** Window flag: ask that the system wallpaper be shown behind |
| 570 | * your window. The window surface must be translucent to be able |
| 571 | * to actually see the wallpaper behind it; this flag just ensures |
| 572 | * that the wallpaper surface will be there if this window actually |
| 573 | * has translucent regions. |
| 574 | */ |
| 575 | public static final int FLAG_SHOW_WALLPAPER = 0x00100000; |
| 576 | |
Dianne Hackborn | 93e462b | 2009-09-15 22:50:40 -0700 | [diff] [blame] | 577 | /** Window flag: when set as a window is being added or made |
| 578 | * visible, once the window has been shown then the system will |
| 579 | * poke the power manager's user activity (as if the user had woken |
| 580 | * up the device) to turn the screen on. */ |
| 581 | public static final int FLAG_TURN_SCREEN_ON = 0x00200000; |
| 582 | |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 583 | /** Window flag: when set the window will cause the keyguard to |
| 584 | * be dismissed, only if it is not a secure lock keyguard. Because such |
| 585 | * a keyguard is not needed for security, it will never re-appear if |
| 586 | * the user navigates to another window (in contrast to |
| 587 | * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily |
| 588 | * hide both secure and non-secure keyguards but ensure they reappear |
| 589 | * when the user moves to another UI that doesn't hide them). |
| 590 | * If the keyguard is currently active and is secure (requires an |
| 591 | * unlock pattern) than the user will still need to confirm it before |
| 592 | * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has |
Daniel Sandler | ae069f7 | 2010-06-17 21:56:26 -0400 | [diff] [blame] | 593 | * also been set. |
| 594 | */ |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 595 | public static final int FLAG_DISMISS_KEYGUARD = 0x00400000; |
Jeff Brown | 01ce2e9 | 2010-09-26 22:20:12 -0700 | [diff] [blame] | 596 | |
| 597 | /** Window flag: when set the window will accept for touch events |
| 598 | * outside of its bounds to be sent to other windows that also |
| 599 | * support split touch. When this flag is not set, the first pointer |
| 600 | * that goes down determines the window to which all subsequent touches |
| 601 | * go until all pointers go up. When this flag is set, each pointer |
| 602 | * (not necessarily the first) that goes down determines the window |
| 603 | * to which all subsequent touches of that pointer will go until that |
| 604 | * pointer goes up thereby enabling touches with multiple pointers |
| 605 | * to be split across multiple windows. |
Dianne Hackborn | d9b3b7e | 2010-11-16 18:22:49 -0800 | [diff] [blame] | 606 | */ |
Jeff Brown | 01ce2e9 | 2010-09-26 22:20:12 -0700 | [diff] [blame] | 607 | public static final int FLAG_SPLIT_TOUCH = 0x00800000; |
Dianne Hackborn | d9b3b7e | 2010-11-16 18:22:49 -0800 | [diff] [blame] | 608 | |
| 609 | /** |
Romain Guy | 72f0a27 | 2011-01-09 16:01:46 -0800 | [diff] [blame] | 610 | * <p>Indicates whether this window should be hardware accelerated. |
| 611 | * Requesting hardware acceleration does not guarantee it will happen.</p> |
| 612 | * |
| 613 | * <p>This flag can be controlled programmatically <em>only</em> to enable |
| 614 | * hardware acceleration. To enable hardware acceleration for a given |
| 615 | * window programmatically, do the following:</p> |
| 616 | * |
| 617 | * <pre> |
| 618 | * Window w = activity.getWindow(); // in Activity's onCreate() for instance |
| 619 | * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, |
| 620 | * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); |
| 621 | * </pre> |
| 622 | * |
| 623 | * <p>It is important to remember that this flag <strong>must</strong> |
| 624 | * be set before setting the content view of your activity or dialog.</p> |
| 625 | * |
| 626 | * <p>This flag cannot be used to disable hardware acceleration after it |
| 627 | * was enabled in your manifest using |
| 628 | * {@link android.R.attr#hardwareAccelerated}. If you need to selectively |
| 629 | * and programmatically disable hardware acceleration (for automated testing |
| 630 | * for instance), make sure it is turned off in your manifest and enable it |
| 631 | * on your activity or dialog when you need it instead, using the method |
| 632 | * described above.</p> |
| 633 | * |
| 634 | * <p>This flag is automatically set by the system if the |
| 635 | * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated} |
| 636 | * XML attribute is set to true on an activity or on the application.</p> |
Dianne Hackborn | d9b3b7e | 2010-11-16 18:22:49 -0800 | [diff] [blame] | 637 | */ |
| 638 | public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000; |
Daniel Sandler | 611fae4 | 2010-06-17 10:45:00 -0400 | [diff] [blame] | 639 | |
Dianne Hackborn | d9b3b7e | 2010-11-16 18:22:49 -0800 | [diff] [blame] | 640 | // ----- HIDDEN FLAGS. |
| 641 | // These start at the high bit and go down. |
Jeff Brown | 98db5fa | 2011-06-08 15:37:10 -0700 | [diff] [blame] | 642 | |
| 643 | /** Window flag: Enable touches to slide out of a window into neighboring |
| 644 | * windows in mid-gesture instead of being captured for the duration of |
| 645 | * the gesture. |
| 646 | * |
| 647 | * This flag changes the behavior of touch focus for this window only. |
| 648 | * Touches can slide out of the window but they cannot necessarily slide |
| 649 | * back in (unless the other window with touch focus permits it). |
| 650 | * |
| 651 | * {@hide} |
| 652 | */ |
| 653 | public static final int FLAG_SLIPPERY = 0x04000000; |
| 654 | |
Daniel Sandler | e02d808 | 2010-10-08 15:13:22 -0400 | [diff] [blame] | 655 | /** |
| 656 | * Flag for a window belonging to an activity that responds to {@link KeyEvent#KEYCODE_MENU} |
| 657 | * and therefore needs a Menu key. For devices where Menu is a physical button this flag is |
| 658 | * ignored, but on devices where the Menu key is drawn in software it may be hidden unless |
| 659 | * this flag is set. |
| 660 | * |
| 661 | * (Note that Action Bars, when available, are the preferred way to offer additional |
| 662 | * functions otherwise accessed via an options menu.) |
| 663 | * |
| 664 | * {@hide} |
| 665 | */ |
Dianne Hackborn | d9b3b7e | 2010-11-16 18:22:49 -0800 | [diff] [blame] | 666 | public static final int FLAG_NEEDS_MENU_KEY = 0x08000000; |
Daniel Sandler | e02d808 | 2010-10-08 15:13:22 -0400 | [diff] [blame] | 667 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 668 | /** Window flag: *sigh* The lock screen wants to continue running its |
| 669 | * animation while it is fading. A kind-of hack to allow this. Maybe |
| 670 | * in the future we just make this the default behavior. |
| 671 | * |
| 672 | * {@hide} */ |
| 673 | public static final int FLAG_KEEP_SURFACE_WHILE_ANIMATING = 0x10000000; |
| 674 | |
Mitsuru Oshima | 1ecf5d2 | 2009-07-06 17:20:38 -0700 | [diff] [blame] | 675 | /** Window flag: special flag to limit the size of the window to be |
| 676 | * original size ([320x480] x density). Used to create window for applications |
| 677 | * running under compatibility mode. |
| 678 | * |
| 679 | * {@hide} */ |
Dianne Hackborn | 4c62fc0 | 2009-08-08 20:40:27 -0700 | [diff] [blame] | 680 | public static final int FLAG_COMPATIBLE_WINDOW = 0x20000000; |
Mitsuru Oshima | 1ecf5d2 | 2009-07-06 17:20:38 -0700 | [diff] [blame] | 681 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 682 | /** Window flag: a special option intended for system dialogs. When |
| 683 | * this flag is set, the window will demand focus unconditionally when |
| 684 | * it is created. |
| 685 | * {@hide} */ |
| 686 | public static final int FLAG_SYSTEM_ERROR = 0x40000000; |
| 687 | |
| 688 | /** |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 689 | * Various behavioral options/flags. Default is none. |
| 690 | * |
| 691 | * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON |
| 692 | * @see #FLAG_DIM_BEHIND |
| 693 | * @see #FLAG_NOT_FOCUSABLE |
| 694 | * @see #FLAG_NOT_TOUCHABLE |
| 695 | * @see #FLAG_NOT_TOUCH_MODAL |
| 696 | * @see #FLAG_TOUCHABLE_WHEN_WAKING |
| 697 | * @see #FLAG_KEEP_SCREEN_ON |
| 698 | * @see #FLAG_LAYOUT_IN_SCREEN |
| 699 | * @see #FLAG_LAYOUT_NO_LIMITS |
| 700 | * @see #FLAG_FULLSCREEN |
| 701 | * @see #FLAG_FORCE_NOT_FULLSCREEN |
| 702 | * @see #FLAG_DITHER |
| 703 | * @see #FLAG_SECURE |
| 704 | * @see #FLAG_SCALED |
| 705 | * @see #FLAG_IGNORE_CHEEK_PRESSES |
| 706 | * @see #FLAG_LAYOUT_INSET_DECOR |
| 707 | * @see #FLAG_ALT_FOCUSABLE_IM |
| 708 | * @see #FLAG_WATCH_OUTSIDE_TOUCH |
| 709 | * @see #FLAG_SHOW_WHEN_LOCKED |
| 710 | * @see #FLAG_SHOW_WALLPAPER |
| 711 | * @see #FLAG_TURN_SCREEN_ON |
| 712 | * @see #FLAG_DISMISS_KEYGUARD |
| 713 | * @see #FLAG_SPLIT_TOUCH |
| 714 | * @see #FLAG_HARDWARE_ACCELERATED |
| 715 | */ |
| 716 | @ViewDebug.ExportedProperty(flagMapping = { |
| 717 | @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, |
| 718 | name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"), |
| 719 | @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND, |
| 720 | name = "FLAG_DIM_BEHIND"), |
| 721 | @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND, |
| 722 | name = "FLAG_BLUR_BEHIND"), |
| 723 | @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE, |
| 724 | name = "FLAG_NOT_FOCUSABLE"), |
| 725 | @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE, |
| 726 | name = "FLAG_NOT_TOUCHABLE"), |
| 727 | @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL, |
| 728 | name = "FLAG_NOT_TOUCH_MODAL"), |
| 729 | @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING, |
| 730 | name = "FLAG_TOUCHABLE_WHEN_WAKING"), |
| 731 | @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON, |
| 732 | name = "FLAG_KEEP_SCREEN_ON"), |
| 733 | @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN, |
| 734 | name = "FLAG_LAYOUT_IN_SCREEN"), |
| 735 | @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS, |
| 736 | name = "FLAG_LAYOUT_NO_LIMITS"), |
| 737 | @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN, |
| 738 | name = "FLAG_FULLSCREEN"), |
| 739 | @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN, |
| 740 | name = "FLAG_FORCE_NOT_FULLSCREEN"), |
| 741 | @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER, |
| 742 | name = "FLAG_DITHER"), |
| 743 | @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE, |
| 744 | name = "FLAG_SECURE"), |
| 745 | @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED, |
| 746 | name = "FLAG_SCALED"), |
| 747 | @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES, |
| 748 | name = "FLAG_IGNORE_CHEEK_PRESSES"), |
| 749 | @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR, |
| 750 | name = "FLAG_LAYOUT_INSET_DECOR"), |
| 751 | @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM, |
| 752 | name = "FLAG_ALT_FOCUSABLE_IM"), |
| 753 | @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH, |
| 754 | name = "FLAG_WATCH_OUTSIDE_TOUCH"), |
| 755 | @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED, |
| 756 | name = "FLAG_SHOW_WHEN_LOCKED"), |
| 757 | @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER, |
| 758 | name = "FLAG_SHOW_WALLPAPER"), |
| 759 | @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON, |
| 760 | name = "FLAG_TURN_SCREEN_ON"), |
| 761 | @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD, |
| 762 | name = "FLAG_DISMISS_KEYGUARD"), |
| 763 | @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH, |
| 764 | name = "FLAG_SPLIT_TOUCH"), |
| 765 | @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED, |
| 766 | name = "FLAG_HARDWARE_ACCELERATED") |
| 767 | }) |
| 768 | public int flags; |
| 769 | |
| 770 | /** |
| 771 | * If the window has requested hardware acceleration, but this is not |
| 772 | * allowed in the process it is in, then still render it as if it is |
| 773 | * hardware accelerated. This is used for the starting preview windows |
| 774 | * in the system process, which don't need to have the overhead of |
| 775 | * hardware acceleration (they are just a static rendering), but should |
| 776 | * be rendered as much to match the actual window of the app even if it |
| 777 | * is hardware accelerated. |
| 778 | * Even if the window isn't hardware accelerated, still do its rendering |
| 779 | * as if it is. |
| 780 | * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows |
| 781 | * that need hardware acceleration (e.g. LockScreen), where hardware acceleration |
| 782 | * is generally disabled. This flag must be specified in addition to |
| 783 | * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system |
| 784 | * windows. |
| 785 | * |
| 786 | * @hide |
| 787 | */ |
| 788 | public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001; |
| 789 | |
| 790 | /** |
| 791 | * In the system process, we globally do not use hardware acceleration |
| 792 | * because there are many threads doing UI there and they an conflict. |
| 793 | * If certain parts of the UI that really do want to use hardware |
| 794 | * acceleration, this flag can be set to force it. This is basically |
| 795 | * for the lock screen. Anyone else using it, you are probably wrong. |
| 796 | * |
| 797 | * @hide |
| 798 | */ |
| 799 | public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002; |
| 800 | |
| 801 | /** |
| 802 | * Control flags that are private to the platform. |
| 803 | * @hide |
| 804 | */ |
| 805 | public int privateFlags; |
| 806 | |
| 807 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 808 | * Given a particular set of window manager flags, determine whether |
| 809 | * such a window may be a target for an input method when it has |
| 810 | * focus. In particular, this checks the |
| 811 | * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM} |
| 812 | * flags and returns true if the combination of the two corresponds |
| 813 | * to a window that needs to be behind the input method so that the |
| 814 | * user can type into it. |
| 815 | * |
| 816 | * @param flags The current window manager flags. |
| 817 | * |
| 818 | * @return Returns true if such a window should be behind/interact |
| 819 | * with an input method, false if not. |
| 820 | */ |
| 821 | public static boolean mayUseInputMethod(int flags) { |
| 822 | switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) { |
| 823 | case 0: |
| 824 | case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM: |
| 825 | return true; |
| 826 | } |
| 827 | return false; |
| 828 | } |
| 829 | |
| 830 | /** |
| 831 | * Mask for {@link #softInputMode} of the bits that determine the |
| 832 | * desired visibility state of the soft input area for this window. |
| 833 | */ |
| 834 | public static final int SOFT_INPUT_MASK_STATE = 0x0f; |
| 835 | |
| 836 | /** |
| 837 | * Visibility state for {@link #softInputMode}: no state has been specified. |
| 838 | */ |
| 839 | public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0; |
| 840 | |
| 841 | /** |
| 842 | * Visibility state for {@link #softInputMode}: please don't change the state of |
| 843 | * the soft input area. |
| 844 | */ |
| 845 | public static final int SOFT_INPUT_STATE_UNCHANGED = 1; |
| 846 | |
| 847 | /** |
| 848 | * Visibility state for {@link #softInputMode}: please hide any soft input |
| 849 | * area when normally appropriate (when the user is navigating |
| 850 | * forward to your window). |
| 851 | */ |
| 852 | public static final int SOFT_INPUT_STATE_HIDDEN = 2; |
| 853 | |
| 854 | /** |
| 855 | * Visibility state for {@link #softInputMode}: please always hide any |
| 856 | * soft input area when this window receives focus. |
| 857 | */ |
| 858 | public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3; |
| 859 | |
| 860 | /** |
| 861 | * Visibility state for {@link #softInputMode}: please show the soft |
| 862 | * input area when normally appropriate (when the user is navigating |
| 863 | * forward to your window). |
| 864 | */ |
| 865 | public static final int SOFT_INPUT_STATE_VISIBLE = 4; |
| 866 | |
| 867 | /** |
| 868 | * Visibility state for {@link #softInputMode}: please always make the |
| 869 | * soft input area visible when this window receives input focus. |
| 870 | */ |
| 871 | public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5; |
| 872 | |
| 873 | /** |
| 874 | * Mask for {@link #softInputMode} of the bits that determine the |
| 875 | * way that the window should be adjusted to accommodate the soft |
| 876 | * input window. |
| 877 | */ |
| 878 | public static final int SOFT_INPUT_MASK_ADJUST = 0xf0; |
| 879 | |
| 880 | /** Adjustment option for {@link #softInputMode}: nothing specified. |
| 881 | * The system will try to pick one or |
| 882 | * the other depending on the contents of the window. |
| 883 | */ |
| 884 | public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00; |
| 885 | |
| 886 | /** Adjustment option for {@link #softInputMode}: set to allow the |
| 887 | * window to be resized when an input |
| 888 | * method is shown, so that its contents are not covered by the input |
Scott Main | f10e633 | 2010-06-11 09:03:22 -0700 | [diff] [blame] | 889 | * method. This can <em>not</em> be combined with |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 890 | * {@link #SOFT_INPUT_ADJUST_PAN}; if |
| 891 | * neither of these are set, then the system will try to pick one or |
| 892 | * the other depending on the contents of the window. |
| 893 | */ |
| 894 | public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10; |
| 895 | |
| 896 | /** Adjustment option for {@link #softInputMode}: set to have a window |
| 897 | * pan when an input method is |
| 898 | * shown, so it doesn't need to deal with resizing but just panned |
| 899 | * by the framework to ensure the current input focus is visible. This |
Scott Main | f10e633 | 2010-06-11 09:03:22 -0700 | [diff] [blame] | 900 | * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 901 | * neither of these are set, then the system will try to pick one or |
| 902 | * the other depending on the contents of the window. |
| 903 | */ |
| 904 | public static final int SOFT_INPUT_ADJUST_PAN = 0x20; |
| 905 | |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 906 | /** Adjustment option for {@link #softInputMode}: set to have a window |
| 907 | * not adjust for a shown input method. The window will not be resized, |
| 908 | * and it will not be panned to make its focus visible. |
| 909 | */ |
| 910 | public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30; |
| 911 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 912 | /** |
| 913 | * Bit for {@link #softInputMode}: set when the user has navigated |
| 914 | * forward to the window. This is normally set automatically for |
| 915 | * you by the system, though you may want to set it in certain cases |
| 916 | * when you are displaying a window yourself. This flag will always |
| 917 | * be cleared automatically after the window is displayed. |
| 918 | */ |
| 919 | public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100; |
Mike Lockwood | fb73f79 | 2009-11-20 11:31:18 -0500 | [diff] [blame] | 920 | |
| 921 | /** |
Gilles Debunne | be2c4f9 | 2011-01-17 15:14:32 -0800 | [diff] [blame] | 922 | * Desired operating mode for any soft input area. May be any combination |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 923 | * of: |
| 924 | * |
| 925 | * <ul> |
| 926 | * <li> One of the visibility states |
| 927 | * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED}, |
| 928 | * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or |
| 929 | * {@link #SOFT_INPUT_STATE_VISIBLE}. |
| 930 | * <li> One of the adjustment options |
| 931 | * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED}, |
| 932 | * {@link #SOFT_INPUT_ADJUST_RESIZE}, or |
| 933 | * {@link #SOFT_INPUT_ADJUST_PAN}. |
| 934 | */ |
| 935 | public int softInputMode; |
| 936 | |
| 937 | /** |
Dianne Hackborn | 8eb2e24 | 2010-11-01 12:31:24 -0700 | [diff] [blame] | 938 | * Placement of window within the screen as per {@link Gravity}. Both |
| 939 | * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, |
| 940 | * android.graphics.Rect) Gravity.apply} and |
| 941 | * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect) |
| 942 | * Gravity.applyDisplay} are used during window layout, with this value |
| 943 | * given as the desired gravity. For example you can specify |
| 944 | * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and |
| 945 | * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here |
| 946 | * to control the behavior of |
| 947 | * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect) |
| 948 | * Gravity.applyDisplay}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 949 | * |
| 950 | * @see Gravity |
| 951 | */ |
| 952 | public int gravity; |
| 953 | |
| 954 | /** |
| 955 | * The horizontal margin, as a percentage of the container's width, |
Dianne Hackborn | 8eb2e24 | 2010-11-01 12:31:24 -0700 | [diff] [blame] | 956 | * between the container and the widget. See |
| 957 | * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, |
| 958 | * android.graphics.Rect) Gravity.apply} for how this is used. This |
| 959 | * field is added with {@link #x} to supply the <var>xAdj</var> parameter. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 960 | */ |
| 961 | public float horizontalMargin; |
| 962 | |
| 963 | /** |
| 964 | * The vertical margin, as a percentage of the container's height, |
Dianne Hackborn | 8eb2e24 | 2010-11-01 12:31:24 -0700 | [diff] [blame] | 965 | * between the container and the widget. See |
| 966 | * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, |
| 967 | * android.graphics.Rect) Gravity.apply} for how this is used. This |
| 968 | * field is added with {@link #y} to supply the <var>yAdj</var> parameter. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 969 | */ |
| 970 | public float verticalMargin; |
| 971 | |
| 972 | /** |
| 973 | * The desired bitmap format. May be one of the constants in |
| 974 | * {@link android.graphics.PixelFormat}. Default is OPAQUE. |
| 975 | */ |
| 976 | public int format; |
| 977 | |
| 978 | /** |
| 979 | * A style resource defining the animations to use for this window. |
| 980 | * This must be a system resource; it can not be an application resource |
| 981 | * because the window manager does not have access to applications. |
| 982 | */ |
| 983 | public int windowAnimations; |
| 984 | |
| 985 | /** |
| 986 | * An alpha value to apply to this entire window. |
| 987 | * An alpha of 1.0 means fully opaque and 0.0 means fully transparent |
| 988 | */ |
| 989 | public float alpha = 1.0f; |
| 990 | |
| 991 | /** |
| 992 | * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming |
| 993 | * to apply. Range is from 1.0 for completely opaque to 0.0 for no |
| 994 | * dim. |
| 995 | */ |
| 996 | public float dimAmount = 1.0f; |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 997 | |
| 998 | /** |
| 999 | * Default value for {@link #screenBrightness} and {@link #buttonBrightness} |
| 1000 | * indicating that the brightness value is not overridden for this window |
| 1001 | * and normal brightness policy should be used. |
| 1002 | */ |
| 1003 | public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f; |
| 1004 | |
| 1005 | /** |
| 1006 | * Value for {@link #screenBrightness} and {@link #buttonBrightness} |
| 1007 | * indicating that the screen or button backlight brightness should be set |
| 1008 | * to the lowest value when this window is in front. |
| 1009 | */ |
| 1010 | public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f; |
| 1011 | |
| 1012 | /** |
| 1013 | * Value for {@link #screenBrightness} and {@link #buttonBrightness} |
| 1014 | * indicating that the screen or button backlight brightness should be set |
| 1015 | * to the hightest value when this window is in front. |
| 1016 | */ |
| 1017 | public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1018 | |
| 1019 | /** |
| 1020 | * This can be used to override the user's preferred brightness of |
| 1021 | * the screen. A value of less than 0, the default, means to use the |
| 1022 | * preferred screen brightness. 0 to 1 adjusts the brightness from |
| 1023 | * dark to full bright. |
| 1024 | */ |
Mike Lockwood | fb73f79 | 2009-11-20 11:31:18 -0500 | [diff] [blame] | 1025 | public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1026 | |
| 1027 | /** |
Mike Lockwood | fb73f79 | 2009-11-20 11:31:18 -0500 | [diff] [blame] | 1028 | * This can be used to override the standard behavior of the button and |
| 1029 | * keyboard backlights. A value of less than 0, the default, means to |
| 1030 | * use the standard backlight behavior. 0 to 1 adjusts the brightness |
| 1031 | * from dark to full bright. |
| 1032 | */ |
| 1033 | public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE; |
| 1034 | |
| 1035 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1036 | * Identifier for this window. This will usually be filled in for |
| 1037 | * you. |
| 1038 | */ |
| 1039 | public IBinder token = null; |
| 1040 | |
| 1041 | /** |
| 1042 | * Name of the package owning this window. |
| 1043 | */ |
| 1044 | public String packageName = null; |
| 1045 | |
| 1046 | /** |
| 1047 | * Specific orientation value for a window. |
| 1048 | * May be any of the same values allowed |
| 1049 | * for {@link android.content.pm.ActivityInfo#screenOrientation}. |
| 1050 | * If not set, a default value of |
| 1051 | * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED} |
| 1052 | * will be used. |
| 1053 | */ |
| 1054 | public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1055 | |
| 1056 | /** |
| 1057 | * Control the visibility of the status bar. |
Joe Onorato | 14782f7 | 2011-01-25 19:53:17 -0800 | [diff] [blame] | 1058 | * |
| 1059 | * @see View#STATUS_BAR_VISIBLE |
| 1060 | * @see View#STATUS_BAR_HIDDEN |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1061 | */ |
| 1062 | public int systemUiVisibility; |
| 1063 | |
| 1064 | /** |
Joe Onorato | 14782f7 | 2011-01-25 19:53:17 -0800 | [diff] [blame] | 1065 | * @hide |
| 1066 | * The ui visibility as requested by the views in this hierarchy. |
| 1067 | * the combined value should be systemUiVisibility | subtreeSystemUiVisibility. |
| 1068 | */ |
| 1069 | public int subtreeSystemUiVisibility; |
| 1070 | |
| 1071 | /** |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1072 | * Get callbacks about the system ui visibility changing. |
| 1073 | * |
| 1074 | * TODO: Maybe there should be a bitfield of optional callbacks that we need. |
| 1075 | * |
| 1076 | * @hide |
| 1077 | */ |
| 1078 | public boolean hasSystemUiListeners; |
| 1079 | |
Jeff Brown | 474dcb5 | 2011-06-14 20:22:50 -0700 | [diff] [blame] | 1080 | /** |
| 1081 | * When this window has focus, disable touch pad pointer gesture processing. |
| 1082 | * The window will receive raw position updates from the touch pad instead |
| 1083 | * of pointer movements and synthetic touch events. |
| 1084 | * |
| 1085 | * @hide |
| 1086 | */ |
| 1087 | public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001; |
| 1088 | |
| 1089 | /** |
Jeff Brown | cc4f7db | 2011-08-30 20:34:48 -0700 | [diff] [blame] | 1090 | * Does not construct an input channel for this window. The channel will therefore |
| 1091 | * be incapable of receiving input. |
| 1092 | * |
| 1093 | * @hide |
| 1094 | */ |
| 1095 | public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002; |
| 1096 | |
| 1097 | /** |
Jeff Brown | 474dcb5 | 2011-06-14 20:22:50 -0700 | [diff] [blame] | 1098 | * Control special features of the input subsystem. |
| 1099 | * |
| 1100 | * @see #INPUT_FEATURE_DISABLE_TOUCH_PAD_GESTURES |
Jeff Brown | cc4f7db | 2011-08-30 20:34:48 -0700 | [diff] [blame] | 1101 | * @see #INPUT_FEATURE_NO_INPUT_CHANNEL |
Jeff Brown | 474dcb5 | 2011-06-14 20:22:50 -0700 | [diff] [blame] | 1102 | * @hide |
| 1103 | */ |
| 1104 | public int inputFeatures; |
| 1105 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1106 | public LayoutParams() { |
Romain Guy | 980a938 | 2010-01-08 15:06:28 -0800 | [diff] [blame] | 1107 | super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1108 | type = TYPE_APPLICATION; |
| 1109 | format = PixelFormat.OPAQUE; |
| 1110 | } |
| 1111 | |
| 1112 | public LayoutParams(int _type) { |
Romain Guy | 980a938 | 2010-01-08 15:06:28 -0800 | [diff] [blame] | 1113 | super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1114 | type = _type; |
| 1115 | format = PixelFormat.OPAQUE; |
| 1116 | } |
| 1117 | |
| 1118 | public LayoutParams(int _type, int _flags) { |
Romain Guy | 980a938 | 2010-01-08 15:06:28 -0800 | [diff] [blame] | 1119 | super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1120 | type = _type; |
| 1121 | flags = _flags; |
| 1122 | format = PixelFormat.OPAQUE; |
| 1123 | } |
| 1124 | |
| 1125 | public LayoutParams(int _type, int _flags, int _format) { |
Romain Guy | 980a938 | 2010-01-08 15:06:28 -0800 | [diff] [blame] | 1126 | super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1127 | type = _type; |
| 1128 | flags = _flags; |
| 1129 | format = _format; |
| 1130 | } |
| 1131 | |
| 1132 | public LayoutParams(int w, int h, int _type, int _flags, int _format) { |
| 1133 | super(w, h); |
| 1134 | type = _type; |
| 1135 | flags = _flags; |
| 1136 | format = _format; |
| 1137 | } |
| 1138 | |
| 1139 | public LayoutParams(int w, int h, int xpos, int ypos, int _type, |
| 1140 | int _flags, int _format) { |
| 1141 | super(w, h); |
| 1142 | x = xpos; |
| 1143 | y = ypos; |
| 1144 | type = _type; |
| 1145 | flags = _flags; |
| 1146 | format = _format; |
| 1147 | } |
| 1148 | |
| 1149 | public final void setTitle(CharSequence title) { |
| 1150 | if (null == title) |
| 1151 | title = ""; |
| 1152 | |
| 1153 | mTitle = TextUtils.stringOrSpannedString(title); |
| 1154 | } |
| 1155 | |
| 1156 | public final CharSequence getTitle() { |
| 1157 | return mTitle; |
| 1158 | } |
| 1159 | |
| 1160 | public int describeContents() { |
| 1161 | return 0; |
| 1162 | } |
| 1163 | |
| 1164 | public void writeToParcel(Parcel out, int parcelableFlags) { |
| 1165 | out.writeInt(width); |
| 1166 | out.writeInt(height); |
| 1167 | out.writeInt(x); |
| 1168 | out.writeInt(y); |
| 1169 | out.writeInt(type); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1170 | out.writeInt(flags); |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 1171 | out.writeInt(privateFlags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1172 | out.writeInt(softInputMode); |
| 1173 | out.writeInt(gravity); |
| 1174 | out.writeFloat(horizontalMargin); |
| 1175 | out.writeFloat(verticalMargin); |
| 1176 | out.writeInt(format); |
| 1177 | out.writeInt(windowAnimations); |
| 1178 | out.writeFloat(alpha); |
| 1179 | out.writeFloat(dimAmount); |
| 1180 | out.writeFloat(screenBrightness); |
Mike Lockwood | fb73f79 | 2009-11-20 11:31:18 -0500 | [diff] [blame] | 1181 | out.writeFloat(buttonBrightness); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1182 | out.writeStrongBinder(token); |
| 1183 | out.writeString(packageName); |
| 1184 | TextUtils.writeToParcel(mTitle, out, parcelableFlags); |
| 1185 | out.writeInt(screenOrientation); |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1186 | out.writeInt(systemUiVisibility); |
Joe Onorato | 14782f7 | 2011-01-25 19:53:17 -0800 | [diff] [blame] | 1187 | out.writeInt(subtreeSystemUiVisibility); |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1188 | out.writeInt(hasSystemUiListeners ? 1 : 0); |
Jeff Brown | 474dcb5 | 2011-06-14 20:22:50 -0700 | [diff] [blame] | 1189 | out.writeInt(inputFeatures); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1190 | } |
| 1191 | |
| 1192 | public static final Parcelable.Creator<LayoutParams> CREATOR |
| 1193 | = new Parcelable.Creator<LayoutParams>() { |
| 1194 | public LayoutParams createFromParcel(Parcel in) { |
| 1195 | return new LayoutParams(in); |
| 1196 | } |
| 1197 | |
| 1198 | public LayoutParams[] newArray(int size) { |
| 1199 | return new LayoutParams[size]; |
| 1200 | } |
| 1201 | }; |
| 1202 | |
| 1203 | |
| 1204 | public LayoutParams(Parcel in) { |
| 1205 | width = in.readInt(); |
| 1206 | height = in.readInt(); |
| 1207 | x = in.readInt(); |
| 1208 | y = in.readInt(); |
| 1209 | type = in.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1210 | flags = in.readInt(); |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 1211 | privateFlags = in.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1212 | softInputMode = in.readInt(); |
| 1213 | gravity = in.readInt(); |
| 1214 | horizontalMargin = in.readFloat(); |
| 1215 | verticalMargin = in.readFloat(); |
| 1216 | format = in.readInt(); |
| 1217 | windowAnimations = in.readInt(); |
| 1218 | alpha = in.readFloat(); |
| 1219 | dimAmount = in.readFloat(); |
| 1220 | screenBrightness = in.readFloat(); |
Mike Lockwood | fb73f79 | 2009-11-20 11:31:18 -0500 | [diff] [blame] | 1221 | buttonBrightness = in.readFloat(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1222 | token = in.readStrongBinder(); |
| 1223 | packageName = in.readString(); |
| 1224 | mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); |
| 1225 | screenOrientation = in.readInt(); |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1226 | systemUiVisibility = in.readInt(); |
Joe Onorato | 14782f7 | 2011-01-25 19:53:17 -0800 | [diff] [blame] | 1227 | subtreeSystemUiVisibility = in.readInt(); |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1228 | hasSystemUiListeners = in.readInt() != 0; |
Jeff Brown | 474dcb5 | 2011-06-14 20:22:50 -0700 | [diff] [blame] | 1229 | inputFeatures = in.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1230 | } |
| 1231 | |
Romain Guy | 7299807 | 2009-06-22 11:09:20 -0700 | [diff] [blame] | 1232 | @SuppressWarnings({"PointlessBitwiseExpression"}) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1233 | public static final int LAYOUT_CHANGED = 1<<0; |
| 1234 | public static final int TYPE_CHANGED = 1<<1; |
| 1235 | public static final int FLAGS_CHANGED = 1<<2; |
| 1236 | public static final int FORMAT_CHANGED = 1<<3; |
| 1237 | public static final int ANIMATION_CHANGED = 1<<4; |
| 1238 | public static final int DIM_AMOUNT_CHANGED = 1<<5; |
| 1239 | public static final int TITLE_CHANGED = 1<<6; |
| 1240 | public static final int ALPHA_CHANGED = 1<<7; |
| 1241 | public static final int MEMORY_TYPE_CHANGED = 1<<8; |
| 1242 | public static final int SOFT_INPUT_MODE_CHANGED = 1<<9; |
| 1243 | public static final int SCREEN_ORIENTATION_CHANGED = 1<<10; |
| 1244 | public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11; |
Mike Lockwood | fb73f79 | 2009-11-20 11:31:18 -0500 | [diff] [blame] | 1245 | /** {@hide} */ |
| 1246 | public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<12; |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1247 | /** {@hide} */ |
| 1248 | public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<13; |
| 1249 | /** {@hide} */ |
| 1250 | public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<14; |
Jeff Brown | 474dcb5 | 2011-06-14 20:22:50 -0700 | [diff] [blame] | 1251 | /** {@hide} */ |
| 1252 | public static final int INPUT_FEATURES_CHANGED = 1<<15; |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 1253 | /** {@hide} */ |
| 1254 | public static final int PRIVATE_FLAGS_CHANGED = 1<<16; |
Romain Guy | f21c9b0 | 2011-09-06 16:56:54 -0700 | [diff] [blame^] | 1255 | /** {@hide} */ |
| 1256 | public static final int BUFFER_CHANGED = 1<<17; |
| 1257 | /** {@hide} */ |
| 1258 | public static final int EVERYTHING_CHANGED = 0xffffffff; |
| 1259 | |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 1260 | // internal buffer to backup/restore parameters under compatibility mode. |
| 1261 | private int[] mCompatibilityParamsBackup = null; |
| 1262 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1263 | public final int copyFrom(LayoutParams o) { |
| 1264 | int changes = 0; |
| 1265 | |
| 1266 | if (width != o.width) { |
| 1267 | width = o.width; |
Romain Guy | f21c9b0 | 2011-09-06 16:56:54 -0700 | [diff] [blame^] | 1268 | changes |= LAYOUT_CHANGED | BUFFER_CHANGED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1269 | } |
| 1270 | if (height != o.height) { |
| 1271 | height = o.height; |
Romain Guy | f21c9b0 | 2011-09-06 16:56:54 -0700 | [diff] [blame^] | 1272 | changes |= LAYOUT_CHANGED | BUFFER_CHANGED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1273 | } |
| 1274 | if (x != o.x) { |
| 1275 | x = o.x; |
| 1276 | changes |= LAYOUT_CHANGED; |
| 1277 | } |
| 1278 | if (y != o.y) { |
| 1279 | y = o.y; |
| 1280 | changes |= LAYOUT_CHANGED; |
| 1281 | } |
| 1282 | if (horizontalWeight != o.horizontalWeight) { |
| 1283 | horizontalWeight = o.horizontalWeight; |
Romain Guy | f21c9b0 | 2011-09-06 16:56:54 -0700 | [diff] [blame^] | 1284 | changes |= LAYOUT_CHANGED | BUFFER_CHANGED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1285 | } |
| 1286 | if (verticalWeight != o.verticalWeight) { |
| 1287 | verticalWeight = o.verticalWeight; |
Romain Guy | f21c9b0 | 2011-09-06 16:56:54 -0700 | [diff] [blame^] | 1288 | changes |= LAYOUT_CHANGED | BUFFER_CHANGED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1289 | } |
| 1290 | if (horizontalMargin != o.horizontalMargin) { |
| 1291 | horizontalMargin = o.horizontalMargin; |
Romain Guy | f21c9b0 | 2011-09-06 16:56:54 -0700 | [diff] [blame^] | 1292 | changes |= LAYOUT_CHANGED | BUFFER_CHANGED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1293 | } |
| 1294 | if (verticalMargin != o.verticalMargin) { |
| 1295 | verticalMargin = o.verticalMargin; |
Romain Guy | f21c9b0 | 2011-09-06 16:56:54 -0700 | [diff] [blame^] | 1296 | changes |= LAYOUT_CHANGED | BUFFER_CHANGED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1297 | } |
| 1298 | if (type != o.type) { |
| 1299 | type = o.type; |
| 1300 | changes |= TYPE_CHANGED; |
| 1301 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1302 | if (flags != o.flags) { |
| 1303 | flags = o.flags; |
Romain Guy | f21c9b0 | 2011-09-06 16:56:54 -0700 | [diff] [blame^] | 1304 | changes |= FLAGS_CHANGED | BUFFER_CHANGED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1305 | } |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 1306 | if (privateFlags != o.privateFlags) { |
| 1307 | privateFlags = o.privateFlags; |
| 1308 | changes |= PRIVATE_FLAGS_CHANGED; |
| 1309 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1310 | if (softInputMode != o.softInputMode) { |
| 1311 | softInputMode = o.softInputMode; |
| 1312 | changes |= SOFT_INPUT_MODE_CHANGED; |
| 1313 | } |
| 1314 | if (gravity != o.gravity) { |
| 1315 | gravity = o.gravity; |
Romain Guy | f21c9b0 | 2011-09-06 16:56:54 -0700 | [diff] [blame^] | 1316 | changes |= LAYOUT_CHANGED | BUFFER_CHANGED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1317 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1318 | if (format != o.format) { |
| 1319 | format = o.format; |
Romain Guy | f21c9b0 | 2011-09-06 16:56:54 -0700 | [diff] [blame^] | 1320 | changes |= FORMAT_CHANGED | BUFFER_CHANGED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1321 | } |
| 1322 | if (windowAnimations != o.windowAnimations) { |
| 1323 | windowAnimations = o.windowAnimations; |
| 1324 | changes |= ANIMATION_CHANGED; |
| 1325 | } |
| 1326 | if (token == null) { |
| 1327 | // NOTE: token only copied if the recipient doesn't |
| 1328 | // already have one. |
| 1329 | token = o.token; |
| 1330 | } |
| 1331 | if (packageName == null) { |
| 1332 | // NOTE: packageName only copied if the recipient doesn't |
| 1333 | // already have one. |
| 1334 | packageName = o.packageName; |
| 1335 | } |
| 1336 | if (!mTitle.equals(o.mTitle)) { |
| 1337 | mTitle = o.mTitle; |
| 1338 | changes |= TITLE_CHANGED; |
| 1339 | } |
| 1340 | if (alpha != o.alpha) { |
| 1341 | alpha = o.alpha; |
| 1342 | changes |= ALPHA_CHANGED; |
| 1343 | } |
| 1344 | if (dimAmount != o.dimAmount) { |
| 1345 | dimAmount = o.dimAmount; |
| 1346 | changes |= DIM_AMOUNT_CHANGED; |
| 1347 | } |
| 1348 | if (screenBrightness != o.screenBrightness) { |
| 1349 | screenBrightness = o.screenBrightness; |
| 1350 | changes |= SCREEN_BRIGHTNESS_CHANGED; |
| 1351 | } |
Mike Lockwood | fb73f79 | 2009-11-20 11:31:18 -0500 | [diff] [blame] | 1352 | if (buttonBrightness != o.buttonBrightness) { |
| 1353 | buttonBrightness = o.buttonBrightness; |
| 1354 | changes |= BUTTON_BRIGHTNESS_CHANGED; |
| 1355 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1356 | |
| 1357 | if (screenOrientation != o.screenOrientation) { |
| 1358 | screenOrientation = o.screenOrientation; |
Romain Guy | f21c9b0 | 2011-09-06 16:56:54 -0700 | [diff] [blame^] | 1359 | changes |= SCREEN_ORIENTATION_CHANGED | BUFFER_CHANGED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1360 | } |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 1361 | |
Joe Onorato | 14782f7 | 2011-01-25 19:53:17 -0800 | [diff] [blame] | 1362 | if (systemUiVisibility != o.systemUiVisibility |
| 1363 | || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) { |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1364 | systemUiVisibility = o.systemUiVisibility; |
Joe Onorato | 14782f7 | 2011-01-25 19:53:17 -0800 | [diff] [blame] | 1365 | subtreeSystemUiVisibility = o.subtreeSystemUiVisibility; |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1366 | changes |= SYSTEM_UI_VISIBILITY_CHANGED; |
| 1367 | } |
| 1368 | |
| 1369 | if (hasSystemUiListeners != o.hasSystemUiListeners) { |
| 1370 | hasSystemUiListeners = o.hasSystemUiListeners; |
| 1371 | changes |= SYSTEM_UI_LISTENER_CHANGED; |
| 1372 | } |
| 1373 | |
Jeff Brown | 474dcb5 | 2011-06-14 20:22:50 -0700 | [diff] [blame] | 1374 | if (inputFeatures != o.inputFeatures) { |
| 1375 | inputFeatures = o.inputFeatures; |
| 1376 | changes |= INPUT_FEATURES_CHANGED; |
| 1377 | } |
| 1378 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1379 | return changes; |
| 1380 | } |
| 1381 | |
| 1382 | @Override |
| 1383 | public String debug(String output) { |
| 1384 | output += "Contents of " + this + ":"; |
| 1385 | Log.d("Debug", output); |
| 1386 | output = super.debug(""); |
| 1387 | Log.d("Debug", output); |
| 1388 | Log.d("Debug", ""); |
| 1389 | Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}"); |
| 1390 | return ""; |
| 1391 | } |
| 1392 | |
| 1393 | @Override |
| 1394 | public String toString() { |
| 1395 | StringBuilder sb = new StringBuilder(256); |
| 1396 | sb.append("WM.LayoutParams{"); |
| 1397 | sb.append("("); |
| 1398 | sb.append(x); |
| 1399 | sb.append(','); |
| 1400 | sb.append(y); |
| 1401 | sb.append(")("); |
Romain Guy | 980a938 | 2010-01-08 15:06:28 -0800 | [diff] [blame] | 1402 | sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width))); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1403 | sb.append('x'); |
Romain Guy | 980a938 | 2010-01-08 15:06:28 -0800 | [diff] [blame] | 1404 | sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height))); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1405 | sb.append(")"); |
Dianne Hackborn | 8eb2e24 | 2010-11-01 12:31:24 -0700 | [diff] [blame] | 1406 | if (horizontalMargin != 0) { |
| 1407 | sb.append(" hm="); |
| 1408 | sb.append(horizontalMargin); |
| 1409 | } |
| 1410 | if (verticalMargin != 0) { |
| 1411 | sb.append(" vm="); |
| 1412 | sb.append(verticalMargin); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1413 | } |
| 1414 | if (gravity != 0) { |
| 1415 | sb.append(" gr=#"); |
| 1416 | sb.append(Integer.toHexString(gravity)); |
| 1417 | } |
Dianne Hackborn | 8eb2e24 | 2010-11-01 12:31:24 -0700 | [diff] [blame] | 1418 | if (softInputMode != 0) { |
| 1419 | sb.append(" sim=#"); |
| 1420 | sb.append(Integer.toHexString(softInputMode)); |
| 1421 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1422 | sb.append(" ty="); |
| 1423 | sb.append(type); |
| 1424 | sb.append(" fl=#"); |
| 1425 | sb.append(Integer.toHexString(flags)); |
Dianne Hackborn | 5d927c2 | 2011-09-02 12:22:18 -0700 | [diff] [blame] | 1426 | if (privateFlags != 0) { |
| 1427 | sb.append(" pfl=0x").append(Integer.toHexString(privateFlags)); |
| 1428 | } |
Dianne Hackborn | a44abeb | 2011-08-08 19:24:01 -0700 | [diff] [blame] | 1429 | if (format != PixelFormat.OPAQUE) { |
| 1430 | sb.append(" fmt="); |
| 1431 | sb.append(format); |
| 1432 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1433 | if (windowAnimations != 0) { |
| 1434 | sb.append(" wanim=0x"); |
| 1435 | sb.append(Integer.toHexString(windowAnimations)); |
| 1436 | } |
| 1437 | if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) { |
| 1438 | sb.append(" or="); |
| 1439 | sb.append(screenOrientation); |
| 1440 | } |
Dianne Hackborn | 8eb2e24 | 2010-11-01 12:31:24 -0700 | [diff] [blame] | 1441 | if (alpha != 1.0f) { |
| 1442 | sb.append(" alpha="); |
| 1443 | sb.append(alpha); |
| 1444 | } |
| 1445 | if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) { |
| 1446 | sb.append(" sbrt="); |
| 1447 | sb.append(screenBrightness); |
| 1448 | } |
| 1449 | if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) { |
| 1450 | sb.append(" bbrt="); |
| 1451 | sb.append(buttonBrightness); |
| 1452 | } |
Mitsuru Oshima | 5a2b91d | 2009-07-16 16:30:02 -0700 | [diff] [blame] | 1453 | if ((flags & FLAG_COMPATIBLE_WINDOW) != 0) { |
| 1454 | sb.append(" compatible=true"); |
| 1455 | } |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1456 | if (systemUiVisibility != 0) { |
| 1457 | sb.append(" sysui=0x"); |
| 1458 | sb.append(Integer.toHexString(systemUiVisibility)); |
| 1459 | } |
Joe Onorato | 14782f7 | 2011-01-25 19:53:17 -0800 | [diff] [blame] | 1460 | if (subtreeSystemUiVisibility != 0) { |
| 1461 | sb.append(" vsysui=0x"); |
| 1462 | sb.append(Integer.toHexString(subtreeSystemUiVisibility)); |
| 1463 | } |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1464 | if (hasSystemUiListeners) { |
| 1465 | sb.append(" sysuil="); |
| 1466 | sb.append(hasSystemUiListeners); |
| 1467 | } |
Dianne Hackborn | a44abeb | 2011-08-08 19:24:01 -0700 | [diff] [blame] | 1468 | if (inputFeatures != 0) { |
| 1469 | sb.append(" if=0x").append(Integer.toHexString(inputFeatures)); |
| 1470 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1471 | sb.append('}'); |
| 1472 | return sb.toString(); |
| 1473 | } |
Mitsuru Oshima | 8d11267 | 2009-04-27 12:01:23 -0700 | [diff] [blame] | 1474 | |
Mitsuru Oshima | 3d91492 | 2009-05-13 22:29:15 -0700 | [diff] [blame] | 1475 | /** |
| 1476 | * Scale the layout params' coordinates and size. |
Mitsuru Oshima | 64f5934 | 2009-06-21 00:03:11 -0700 | [diff] [blame] | 1477 | * @hide |
Mitsuru Oshima | 3d91492 | 2009-05-13 22:29:15 -0700 | [diff] [blame] | 1478 | */ |
Mitsuru Oshima | 64f5934 | 2009-06-21 00:03:11 -0700 | [diff] [blame] | 1479 | public void scale(float scale) { |
Mitsuru Oshima | 61324e5 | 2009-07-21 15:40:36 -0700 | [diff] [blame] | 1480 | x = (int) (x * scale + 0.5f); |
| 1481 | y = (int) (y * scale + 0.5f); |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 1482 | if (width > 0) { |
Mitsuru Oshima | 61324e5 | 2009-07-21 15:40:36 -0700 | [diff] [blame] | 1483 | width = (int) (width * scale + 0.5f); |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 1484 | } |
| 1485 | if (height > 0) { |
Mitsuru Oshima | 61324e5 | 2009-07-21 15:40:36 -0700 | [diff] [blame] | 1486 | height = (int) (height * scale + 0.5f); |
Mitsuru Oshima | 8d11267 | 2009-04-27 12:01:23 -0700 | [diff] [blame] | 1487 | } |
| 1488 | } |
| 1489 | |
Mitsuru Oshima | 3d91492 | 2009-05-13 22:29:15 -0700 | [diff] [blame] | 1490 | /** |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 1491 | * Backup the layout parameters used in compatibility mode. |
| 1492 | * @see LayoutParams#restore() |
Mitsuru Oshima | 3d91492 | 2009-05-13 22:29:15 -0700 | [diff] [blame] | 1493 | */ |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 1494 | void backup() { |
| 1495 | int[] backup = mCompatibilityParamsBackup; |
| 1496 | if (backup == null) { |
Mitsuru Oshima | 64f5934 | 2009-06-21 00:03:11 -0700 | [diff] [blame] | 1497 | // we backup 4 elements, x, y, width, height |
| 1498 | backup = mCompatibilityParamsBackup = new int[4]; |
Mitsuru Oshima | 3d91492 | 2009-05-13 22:29:15 -0700 | [diff] [blame] | 1499 | } |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 1500 | backup[0] = x; |
| 1501 | backup[1] = y; |
| 1502 | backup[2] = width; |
| 1503 | backup[3] = height; |
Mitsuru Oshima | e5fb328 | 2009-06-09 21:16:08 -0700 | [diff] [blame] | 1504 | } |
| 1505 | |
| 1506 | /** |
| 1507 | * Restore the layout params' coordinates, size and gravity |
| 1508 | * @see LayoutParams#backup() |
| 1509 | */ |
| 1510 | void restore() { |
| 1511 | int[] backup = mCompatibilityParamsBackup; |
| 1512 | if (backup != null) { |
| 1513 | x = backup[0]; |
| 1514 | y = backup[1]; |
| 1515 | width = backup[2]; |
Mitsuru Oshima | 3d91492 | 2009-05-13 22:29:15 -0700 | [diff] [blame] | 1516 | height = backup[3]; |
| 1517 | } |
| 1518 | } |
| 1519 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1520 | private CharSequence mTitle = ""; |
| 1521 | } |
| 1522 | } |