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