The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.view; |
| 18 | |
| 19 | import android.content.Context; |
| 20 | import android.content.res.Configuration; |
| 21 | import android.graphics.Rect; |
| 22 | import android.os.IBinder; |
| 23 | import android.os.LocalPowerManager; |
| 24 | import android.view.animation.Animation; |
| 25 | |
| 26 | /** |
| 27 | * This interface supplies all UI-specific behavior of the window manager. An |
| 28 | * instance of it is created by the window manager when it starts up, and allows |
| 29 | * customization of window layering, special window types, key dispatching, and |
| 30 | * layout. |
| 31 | * |
| 32 | * <p>Because this provides deep interaction with the system window manager, |
| 33 | * specific methods on this interface can be called from a variety of contexts |
| 34 | * with various restrictions on what they can do. These are encoded through |
| 35 | * a suffixes at the end of a method encoding the thread the method is called |
| 36 | * from and any locks that are held when it is being called; if no suffix |
| 37 | * is attached to a method, then it is not called with any locks and may be |
| 38 | * called from the main window manager thread or another thread calling into |
| 39 | * the window manager. |
| 40 | * |
| 41 | * <p>The current suffixes are: |
| 42 | * |
| 43 | * <dl> |
| 44 | * <dt> Ti <dd> Called from the input thread. This is the thread that |
| 45 | * collects pending input events and dispatches them to the appropriate window. |
| 46 | * It may block waiting for events to be processed, so that the input stream is |
| 47 | * properly serialized. |
| 48 | * <dt> Tq <dd> Called from the low-level input queue thread. This is the |
| 49 | * thread that reads events out of the raw input devices and places them |
| 50 | * into the global input queue that is read by the <var>Ti</var> thread. |
| 51 | * This thread should not block for a long period of time on anything but the |
| 52 | * key driver. |
| 53 | * <dt> Lw <dd> Called with the main window manager lock held. Because the |
| 54 | * window manager is a very low-level system service, there are few other |
| 55 | * system services you can call with this lock held. It is explicitly okay to |
| 56 | * make calls into the package manager and power manager; it is explicitly not |
The Android Open Source Project | c39a6e0 | 2009-03-11 12:11:56 -0700 | [diff] [blame] | 57 | * okay to make calls into the activity manager or most other services. Note that |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 58 | * {@link android.content.Context#checkPermission(String, int, int)} and |
| 59 | * variations require calling into the activity manager. |
| 60 | * <dt> Li <dd> Called with the input thread lock held. This lock can be |
| 61 | * acquired by the window manager while it holds the window lock, so this is |
| 62 | * even more restrictive than <var>Lw</var>. |
| 63 | * </dl> |
| 64 | * |
| 65 | * @hide |
| 66 | */ |
| 67 | public interface WindowManagerPolicy { |
Jeff Brown | b699726 | 2010-10-08 22:31:17 -0700 | [diff] [blame] | 68 | // Policy flags. These flags are also defined in frameworks/base/include/ui/Input.h. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 69 | public final static int FLAG_WAKE = 0x00000001; |
| 70 | public final static int FLAG_WAKE_DROPPED = 0x00000002; |
| 71 | public final static int FLAG_SHIFT = 0x00000004; |
| 72 | public final static int FLAG_CAPS_LOCK = 0x00000008; |
| 73 | public final static int FLAG_ALT = 0x00000010; |
| 74 | public final static int FLAG_ALT_GR = 0x00000020; |
| 75 | public final static int FLAG_MENU = 0x00000040; |
| 76 | public final static int FLAG_LAUNCHER = 0x00000080; |
Jeff Brown | 0eaf393 | 2010-10-01 14:55:30 -0700 | [diff] [blame] | 77 | public final static int FLAG_VIRTUAL = 0x00000100; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 78 | |
Jeff Brown | 85a3176 | 2010-09-01 17:01:00 -0700 | [diff] [blame] | 79 | public final static int FLAG_INJECTED = 0x01000000; |
Jeff Brown | e20c9e0 | 2010-10-11 14:20:19 -0700 | [diff] [blame] | 80 | public final static int FLAG_TRUSTED = 0x02000000; |
Jeff Brown | 85a3176 | 2010-09-01 17:01:00 -0700 | [diff] [blame] | 81 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 82 | public final static int FLAG_WOKE_HERE = 0x10000000; |
| 83 | public final static int FLAG_BRIGHT_HERE = 0x20000000; |
Jeff Brown | b699726 | 2010-10-08 22:31:17 -0700 | [diff] [blame] | 84 | public final static int FLAG_PASS_TO_USER = 0x40000000; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 85 | |
| 86 | public final static boolean WATCH_POINTER = false; |
| 87 | |
| 88 | // flags for interceptKeyTq |
| 89 | /** |
| 90 | * Pass this event to the user / app. To be returned from {@link #interceptKeyTq}. |
| 91 | */ |
| 92 | public final static int ACTION_PASS_TO_USER = 0x00000001; |
| 93 | |
| 94 | /** |
| 95 | * This key event should extend the user activity timeout and turn the lights on. |
| 96 | * To be returned from {@link #interceptKeyTq}. Do not return this and |
| 97 | * {@link #ACTION_GO_TO_SLEEP} or {@link #ACTION_PASS_TO_USER}. |
| 98 | */ |
| 99 | public final static int ACTION_POKE_USER_ACTIVITY = 0x00000002; |
| 100 | |
| 101 | /** |
| 102 | * This key event should put the device to sleep (and engage keyguard if necessary) |
| 103 | * To be returned from {@link #interceptKeyTq}. Do not return this and |
| 104 | * {@link #ACTION_POKE_USER_ACTIVITY} or {@link #ACTION_PASS_TO_USER}. |
| 105 | */ |
| 106 | public final static int ACTION_GO_TO_SLEEP = 0x00000004; |
| 107 | |
| 108 | /** |
| 109 | * Interface to the Window Manager state associated with a particular |
| 110 | * window. You can hold on to an instance of this interface from the call |
| 111 | * to prepareAddWindow() until removeWindow(). |
| 112 | */ |
| 113 | public interface WindowState { |
| 114 | /** |
| 115 | * Perform standard frame computation. The result can be obtained with |
| 116 | * getFrame() if so desired. Must be called with the window manager |
| 117 | * lock held. |
| 118 | * |
| 119 | * @param parentFrame The frame of the parent container this window |
| 120 | * is in, used for computing its basic position. |
| 121 | * @param displayFrame The frame of the overall display in which this |
| 122 | * window can appear, used for constraining the overall dimensions |
| 123 | * of the window. |
| 124 | * @param contentFrame The frame within the display in which we would |
| 125 | * like active content to appear. This will cause windows behind to |
| 126 | * be resized to match the given content frame. |
| 127 | * @param visibleFrame The frame within the display that the window |
| 128 | * is actually visible, used for computing its visible insets to be |
| 129 | * given to windows behind. |
| 130 | * This can be used as a hint for scrolling (avoiding resizing) |
| 131 | * the window to make certain that parts of its content |
| 132 | * are visible. |
| 133 | */ |
| 134 | public void computeFrameLw(Rect parentFrame, Rect displayFrame, |
| 135 | Rect contentFrame, Rect visibleFrame); |
| 136 | |
| 137 | /** |
| 138 | * Retrieve the current frame of the window that has been assigned by |
| 139 | * the window manager. Must be called with the window manager lock held. |
| 140 | * |
| 141 | * @return Rect The rectangle holding the window frame. |
| 142 | */ |
| 143 | public Rect getFrameLw(); |
| 144 | |
| 145 | /** |
| 146 | * Retrieve the current frame of the window that is actually shown. |
| 147 | * Must be called with the window manager lock held. |
| 148 | * |
| 149 | * @return Rect The rectangle holding the shown window frame. |
| 150 | */ |
| 151 | public Rect getShownFrameLw(); |
| 152 | |
| 153 | /** |
| 154 | * Retrieve the frame of the display that this window was last |
| 155 | * laid out in. Must be called with the |
| 156 | * window manager lock held. |
| 157 | * |
| 158 | * @return Rect The rectangle holding the display frame. |
| 159 | */ |
| 160 | public Rect getDisplayFrameLw(); |
| 161 | |
| 162 | /** |
| 163 | * Retrieve the frame of the content area that this window was last |
| 164 | * laid out in. This is the area in which the content of the window |
| 165 | * should be placed. It will be smaller than the display frame to |
| 166 | * account for screen decorations such as a status bar or soft |
| 167 | * keyboard. Must be called with the |
| 168 | * window manager lock held. |
| 169 | * |
| 170 | * @return Rect The rectangle holding the content frame. |
| 171 | */ |
| 172 | public Rect getContentFrameLw(); |
| 173 | |
| 174 | /** |
| 175 | * Retrieve the frame of the visible area that this window was last |
| 176 | * laid out in. This is the area of the screen in which the window |
| 177 | * will actually be fully visible. It will be smaller than the |
| 178 | * content frame to account for transient UI elements blocking it |
| 179 | * such as an input method's candidates UI. Must be called with the |
| 180 | * window manager lock held. |
| 181 | * |
| 182 | * @return Rect The rectangle holding the visible frame. |
| 183 | */ |
| 184 | public Rect getVisibleFrameLw(); |
| 185 | |
| 186 | /** |
| 187 | * Returns true if this window is waiting to receive its given |
| 188 | * internal insets from the client app, and so should not impact the |
| 189 | * layout of other windows. |
| 190 | */ |
| 191 | public boolean getGivenInsetsPendingLw(); |
| 192 | |
| 193 | /** |
| 194 | * Retrieve the insets given by this window's client for the content |
| 195 | * area of windows behind it. Must be called with the |
| 196 | * window manager lock held. |
| 197 | * |
| 198 | * @return Rect The left, top, right, and bottom insets, relative |
| 199 | * to the window's frame, of the actual contents. |
| 200 | */ |
| 201 | public Rect getGivenContentInsetsLw(); |
| 202 | |
| 203 | /** |
| 204 | * Retrieve the insets given by this window's client for the visible |
| 205 | * area of windows behind it. Must be called with the |
| 206 | * window manager lock held. |
| 207 | * |
| 208 | * @return Rect The left, top, right, and bottom insets, relative |
| 209 | * to the window's frame, of the actual visible area. |
| 210 | */ |
| 211 | public Rect getGivenVisibleInsetsLw(); |
| 212 | |
| 213 | /** |
| 214 | * Retrieve the current LayoutParams of the window. |
| 215 | * |
| 216 | * @return WindowManager.LayoutParams The window's internal LayoutParams |
| 217 | * instance. |
| 218 | */ |
| 219 | public WindowManager.LayoutParams getAttrs(); |
| 220 | |
| 221 | /** |
| 222 | * Get the layer at which this window's surface will be Z-ordered. |
| 223 | */ |
| 224 | public int getSurfaceLayer(); |
| 225 | |
| 226 | /** |
| 227 | * Return the token for the application (actually activity) that owns |
| 228 | * this window. May return null for system windows. |
| 229 | * |
| 230 | * @return An IApplicationToken identifying the owning activity. |
| 231 | */ |
| 232 | public IApplicationToken getAppToken(); |
| 233 | |
| 234 | /** |
| 235 | * Return true if, at any point, the application token associated with |
| 236 | * this window has actually displayed any windows. This is most useful |
| 237 | * with the "starting up" window to determine if any windows were |
| 238 | * displayed when it is closed. |
| 239 | * |
| 240 | * @return Returns true if one or more windows have been displayed, |
| 241 | * else false. |
| 242 | */ |
| 243 | public boolean hasAppShownWindows(); |
| 244 | |
| 245 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 246 | * Is this window visible? It is not visible if there is no |
| 247 | * surface, or we are in the process of running an exit animation |
| 248 | * that will remove the surface. |
| 249 | */ |
| 250 | boolean isVisibleLw(); |
| 251 | |
| 252 | /** |
Dianne Hackborn | 3d163f07 | 2009-10-07 21:26:57 -0700 | [diff] [blame] | 253 | * Like {@link #isVisibleLw}, but also counts a window that is currently |
| 254 | * "hidden" behind the keyguard as visible. This allows us to apply |
| 255 | * things like window flags that impact the keyguard. |
| 256 | */ |
| 257 | boolean isVisibleOrBehindKeyguardLw(); |
| 258 | |
| 259 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 260 | * Is this window currently visible to the user on-screen? It is |
| 261 | * displayed either if it is visible or it is currently running an |
| 262 | * animation before no longer being visible. Must be called with the |
| 263 | * window manager lock held. |
| 264 | */ |
| 265 | boolean isDisplayedLw(); |
| 266 | |
| 267 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 268 | * Returns true if this window has been shown on screen at some time in |
| 269 | * the past. Must be called with the window manager lock held. |
| 270 | * |
| 271 | * @return boolean |
| 272 | */ |
| 273 | public boolean hasDrawnLw(); |
| 274 | |
| 275 | /** |
| 276 | * Can be called by the policy to force a window to be hidden, |
| 277 | * regardless of whether the client or window manager would like |
| 278 | * it shown. Must be called with the window manager lock held. |
| 279 | * Returns true if {@link #showLw} was last called for the window. |
| 280 | */ |
| 281 | public boolean hideLw(boolean doAnimation); |
| 282 | |
| 283 | /** |
| 284 | * Can be called to undo the effect of {@link #hideLw}, allowing a |
| 285 | * window to be shown as long as the window manager and client would |
| 286 | * also like it to be shown. Must be called with the window manager |
| 287 | * lock held. |
| 288 | * Returns true if {@link #hideLw} was last called for the window. |
| 289 | */ |
| 290 | public boolean showLw(boolean doAnimation); |
| 291 | } |
| 292 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 293 | /** |
| 294 | * Bit mask that is set for all enter transition. |
| 295 | */ |
| 296 | public final int TRANSIT_ENTER_MASK = 0x1000; |
| 297 | |
| 298 | /** |
| 299 | * Bit mask that is set for all exit transitions. |
| 300 | */ |
| 301 | public final int TRANSIT_EXIT_MASK = 0x2000; |
| 302 | |
Dianne Hackborn | bfe319e | 2009-09-21 00:34:05 -0700 | [diff] [blame] | 303 | /** Not set up for a transition. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 304 | public final int TRANSIT_UNSET = -1; |
Dianne Hackborn | bfe319e | 2009-09-21 00:34:05 -0700 | [diff] [blame] | 305 | /** No animation for transition. */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 306 | public final int TRANSIT_NONE = 0; |
| 307 | /** Window has been added to the screen. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 308 | public final int TRANSIT_ENTER = 1 | TRANSIT_ENTER_MASK; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 309 | /** Window has been removed from the screen. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 310 | public final int TRANSIT_EXIT = 2 | TRANSIT_EXIT_MASK; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 311 | /** Window has been made visible. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 312 | public final int TRANSIT_SHOW = 3 | TRANSIT_ENTER_MASK; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 313 | /** Window has been made invisible. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 314 | public final int TRANSIT_HIDE = 4 | TRANSIT_EXIT_MASK; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 315 | /** The "application starting" preview window is no longer needed, and will |
| 316 | * animate away to show the real window. */ |
| 317 | public final int TRANSIT_PREVIEW_DONE = 5; |
| 318 | /** A window in a new activity is being opened on top of an existing one |
| 319 | * in the same task. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 320 | public final int TRANSIT_ACTIVITY_OPEN = 6 | TRANSIT_ENTER_MASK; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 321 | /** The window in the top-most activity is being closed to reveal the |
| 322 | * previous activity in the same task. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 323 | public final int TRANSIT_ACTIVITY_CLOSE = 7 | TRANSIT_EXIT_MASK; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 324 | /** A window in a new task is being opened on top of an existing one |
| 325 | * in another activity's task. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 326 | public final int TRANSIT_TASK_OPEN = 8 | TRANSIT_ENTER_MASK; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 327 | /** A window in the top-most activity is being closed to reveal the |
| 328 | * previous activity in a different task. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 329 | public final int TRANSIT_TASK_CLOSE = 9 | TRANSIT_EXIT_MASK; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 330 | /** A window in an existing task is being displayed on top of an existing one |
| 331 | * in another activity's task. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 332 | public final int TRANSIT_TASK_TO_FRONT = 10 | TRANSIT_ENTER_MASK; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 333 | /** A window in an existing task is being put below all other tasks. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 334 | public final int TRANSIT_TASK_TO_BACK = 11 | TRANSIT_EXIT_MASK; |
Dianne Hackborn | 25994b4 | 2009-09-04 14:21:19 -0700 | [diff] [blame] | 335 | /** A window in a new activity that doesn't have a wallpaper is being |
| 336 | * opened on top of one that does, effectively closing the wallpaper. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 337 | public final int TRANSIT_WALLPAPER_CLOSE = 12 | TRANSIT_EXIT_MASK; |
Dianne Hackborn | 25994b4 | 2009-09-04 14:21:19 -0700 | [diff] [blame] | 338 | /** A window in a new activity that does have a wallpaper is being |
| 339 | * opened on one that didn't, effectively opening the wallpaper. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 340 | public final int TRANSIT_WALLPAPER_OPEN = 13 | TRANSIT_ENTER_MASK; |
Dianne Hackborn | f8fbdb6 | 2009-08-19 12:39:43 -0700 | [diff] [blame] | 341 | /** A window in a new activity is being opened on top of an existing one, |
| 342 | * and both are on top of the wallpaper. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 343 | public final int TRANSIT_WALLPAPER_INTRA_OPEN = 14 | TRANSIT_ENTER_MASK; |
Dianne Hackborn | f8fbdb6 | 2009-08-19 12:39:43 -0700 | [diff] [blame] | 344 | /** The window in the top-most activity is being closed to reveal the |
| 345 | * previous activity, and both are on top of he wallpaper. */ |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 346 | public final int TRANSIT_WALLPAPER_INTRA_CLOSE = 15 | TRANSIT_EXIT_MASK; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 347 | |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 348 | // NOTE: screen off reasons are in order of significance, with more |
| 349 | // important ones lower than less important ones. |
| 350 | |
| 351 | /** Screen turned off because of a device admin */ |
| 352 | public final int OFF_BECAUSE_OF_ADMIN = 1; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 353 | /** Screen turned off because of power button */ |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 354 | public final int OFF_BECAUSE_OF_USER = 2; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 355 | /** Screen turned off because of timeout */ |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 356 | public final int OFF_BECAUSE_OF_TIMEOUT = 3; |
Mike Lockwood | 435eb64 | 2009-12-03 08:40:18 -0500 | [diff] [blame] | 357 | /** Screen turned off because of proximity sensor */ |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 358 | public final int OFF_BECAUSE_OF_PROX_SENSOR = 4; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 359 | |
| 360 | /** |
| 361 | * Magic constant to {@link IWindowManager#setRotation} to not actually |
| 362 | * modify the rotation. |
| 363 | */ |
| 364 | public final int USE_LAST_ROTATION = -1000; |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 365 | |
| 366 | /** When not otherwise specified by the activity's screenOrientation, rotation should be |
| 367 | * determined by the system (that is, using sensors). */ |
| 368 | public final int USER_ROTATION_FREE = 0; |
| 369 | /** When not otherwise specified by the activity's screenOrientation, rotation is set by |
| 370 | * the user. */ |
| 371 | public final int USER_ROTATION_LOCKED = 1; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 372 | |
| 373 | /** |
| 374 | * Perform initialization of the policy. |
| 375 | * |
| 376 | * @param context The system context we are running in. |
| 377 | * @param powerManager |
| 378 | */ |
| 379 | public void init(Context context, IWindowManager windowManager, |
| 380 | LocalPowerManager powerManager); |
| 381 | |
| 382 | /** |
| 383 | * Check permissions when adding a window. |
| 384 | * |
| 385 | * @param attrs The window's LayoutParams. |
| 386 | * |
| 387 | * @return {@link WindowManagerImpl#ADD_OKAY} if the add can proceed; |
| 388 | * else an error code, usually |
| 389 | * {@link WindowManagerImpl#ADD_PERMISSION_DENIED}, to abort the add. |
| 390 | */ |
| 391 | public int checkAddPermission(WindowManager.LayoutParams attrs); |
| 392 | |
| 393 | /** |
| 394 | * Sanitize the layout parameters coming from a client. Allows the policy |
| 395 | * to do things like ensure that windows of a specific type can't take |
| 396 | * input focus. |
| 397 | * |
| 398 | * @param attrs The window layout parameters to be modified. These values |
| 399 | * are modified in-place. |
| 400 | */ |
| 401 | public void adjustWindowParamsLw(WindowManager.LayoutParams attrs); |
| 402 | |
| 403 | /** |
| 404 | * After the window manager has computed the current configuration based |
| 405 | * on its knowledge of the display and input devices, it gives the policy |
| 406 | * a chance to adjust the information contained in it. If you want to |
| 407 | * leave it as-is, simply do nothing. |
| 408 | * |
| 409 | * <p>This method may be called by any thread in the window manager, but |
| 410 | * no internal locks in the window manager will be held. |
| 411 | * |
| 412 | * @param config The Configuration being computed, for you to change as |
| 413 | * desired. |
| 414 | */ |
| 415 | public void adjustConfigurationLw(Configuration config); |
| 416 | |
| 417 | /** |
| 418 | * Assign a window type to a layer. Allows you to control how different |
| 419 | * kinds of windows are ordered on-screen. |
| 420 | * |
| 421 | * @param type The type of window being assigned. |
| 422 | * |
| 423 | * @return int An arbitrary integer used to order windows, with lower |
| 424 | * numbers below higher ones. |
| 425 | */ |
| 426 | public int windowTypeToLayerLw(int type); |
| 427 | |
| 428 | /** |
| 429 | * Return how to Z-order sub-windows in relation to the window they are |
| 430 | * attached to. Return positive to have them ordered in front, negative for |
| 431 | * behind. |
| 432 | * |
| 433 | * @param type The sub-window type code. |
| 434 | * |
| 435 | * @return int Layer in relation to the attached window, where positive is |
| 436 | * above and negative is below. |
| 437 | */ |
| 438 | public int subWindowTypeToLayerLw(int type); |
| 439 | |
| 440 | /** |
Dianne Hackborn | 6136b7e | 2009-09-18 01:53:49 -0700 | [diff] [blame] | 441 | * Get the highest layer (actually one more than) that the wallpaper is |
| 442 | * allowed to be in. |
| 443 | */ |
| 444 | public int getMaxWallpaperLayer(); |
| 445 | |
| 446 | /** |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 447 | * Return whether the given window should forcibly hide everything |
| 448 | * behind it. Typically returns true for the keyguard. |
| 449 | */ |
| 450 | public boolean doesForceHide(WindowState win, WindowManager.LayoutParams attrs); |
| 451 | |
| 452 | /** |
| 453 | * Determine if a window that is behind one that is force hiding |
| 454 | * (as determined by {@link #doesForceHide}) should actually be hidden. |
| 455 | * For example, typically returns false for the status bar. Be careful |
| 456 | * to return false for any window that you may hide yourself, since this |
| 457 | * will conflict with what you set. |
| 458 | */ |
| 459 | public boolean canBeForceHidden(WindowState win, WindowManager.LayoutParams attrs); |
| 460 | |
| 461 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 462 | * Called when the system would like to show a UI to indicate that an |
| 463 | * application is starting. You can use this to add a |
| 464 | * APPLICATION_STARTING_TYPE window with the given appToken to the window |
| 465 | * manager (using the normal window manager APIs) that will be shown until |
| 466 | * the application displays its own window. This is called without the |
| 467 | * window manager locked so that you can call back into it. |
| 468 | * |
| 469 | * @param appToken Token of the application being started. |
| 470 | * @param packageName The name of the application package being started. |
| 471 | * @param theme Resource defining the application's overall visual theme. |
| 472 | * @param nonLocalizedLabel The default title label of the application if |
| 473 | * no data is found in the resource. |
| 474 | * @param labelRes The resource ID the application would like to use as its name. |
| 475 | * @param icon The resource ID the application would like to use as its icon. |
Dianne Hackborn | 7eec10e | 2010-11-12 18:03:47 -0800 | [diff] [blame] | 476 | * @param windowFlags Window layout flags. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 477 | * |
| 478 | * @return Optionally you can return the View that was used to create the |
| 479 | * window, for easy removal in removeStartingWindow. |
| 480 | * |
| 481 | * @see #removeStartingWindow |
| 482 | */ |
| 483 | public View addStartingWindow(IBinder appToken, String packageName, |
| 484 | int theme, CharSequence nonLocalizedLabel, |
Dianne Hackborn | 7eec10e | 2010-11-12 18:03:47 -0800 | [diff] [blame] | 485 | int labelRes, int icon, int windowFlags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 486 | |
| 487 | /** |
| 488 | * Called when the first window of an application has been displayed, while |
| 489 | * {@link #addStartingWindow} has created a temporary initial window for |
| 490 | * that application. You should at this point remove the window from the |
| 491 | * window manager. This is called without the window manager locked so |
| 492 | * that you can call back into it. |
| 493 | * |
| 494 | * <p>Note: due to the nature of these functions not being called with the |
| 495 | * window manager locked, you must be prepared for this function to be |
| 496 | * called multiple times and/or an initial time with a null View window |
| 497 | * even if you previously returned one. |
| 498 | * |
| 499 | * @param appToken Token of the application that has started. |
| 500 | * @param window Window View that was returned by createStartingWindow. |
| 501 | * |
| 502 | * @see #addStartingWindow |
| 503 | */ |
| 504 | public void removeStartingWindow(IBinder appToken, View window); |
| 505 | |
| 506 | /** |
| 507 | * Prepare for a window being added to the window manager. You can throw an |
| 508 | * exception here to prevent the window being added, or do whatever setup |
| 509 | * you need to keep track of the window. |
| 510 | * |
| 511 | * @param win The window being added. |
| 512 | * @param attrs The window's LayoutParams. |
| 513 | * |
| 514 | * @return {@link WindowManagerImpl#ADD_OKAY} if the add can proceed, else an |
| 515 | * error code to abort the add. |
| 516 | */ |
| 517 | public int prepareAddWindowLw(WindowState win, |
| 518 | WindowManager.LayoutParams attrs); |
| 519 | |
| 520 | /** |
| 521 | * Called when a window is being removed from a window manager. Must not |
| 522 | * throw an exception -- clean up as much as possible. |
| 523 | * |
| 524 | * @param win The window being removed. |
| 525 | */ |
| 526 | public void removeWindowLw(WindowState win); |
| 527 | |
| 528 | /** |
| 529 | * Control the animation to run when a window's state changes. Return a |
| 530 | * non-0 number to force the animation to a specific resource ID, or 0 |
| 531 | * to use the default animation. |
| 532 | * |
| 533 | * @param win The window that is changing. |
| 534 | * @param transit What is happening to the window: {@link #TRANSIT_ENTER}, |
| 535 | * {@link #TRANSIT_EXIT}, {@link #TRANSIT_SHOW}, or |
| 536 | * {@link #TRANSIT_HIDE}. |
| 537 | * |
| 538 | * @return Resource ID of the actual animation to use, or 0 for none. |
| 539 | */ |
| 540 | public int selectAnimationLw(WindowState win, int transit); |
| 541 | |
| 542 | /** |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 543 | * Create and return an animation to re-display a force hidden window. |
| 544 | */ |
| 545 | public Animation createForceHideEnterAnimation(); |
| 546 | |
| 547 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 548 | * Called from the input reader thread before a key is enqueued. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 549 | * |
| 550 | * <p>There are some actions that need to be handled here because they |
| 551 | * affect the power state of the device, for example, the power keys. |
| 552 | * Generally, it's best to keep as little as possible in the queue thread |
| 553 | * because it's the most fragile. |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 554 | * @param event The key event. |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 555 | * @param policyFlags The policy flags associated with the key. |
| 556 | * @param isScreenOn True if the screen is already on |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 557 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 558 | * @return The bitwise or of the {@link #ACTION_PASS_TO_USER}, |
| 559 | * {@link #ACTION_POKE_USER_ACTIVITY} and {@link #ACTION_GO_TO_SLEEP} flags. |
| 560 | */ |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 561 | public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 562 | |
| 563 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 564 | * Called from the input dispatcher thread before a key is dispatched to a window. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 565 | * |
| 566 | * <p>Allows you to define |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 567 | * behavior for keys that can not be overridden by applications. |
| 568 | * This method is called from the input thread, with no locks held. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 569 | * |
| 570 | * @param win The window that currently has focus. This is where the key |
| 571 | * event will normally go. |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 572 | * @param event The key event. |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 573 | * @param policyFlags The policy flags associated with the key. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 574 | * @return Returns true if the policy consumed the event and it should |
| 575 | * not be further dispatched. |
| 576 | */ |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 577 | public boolean interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 578 | |
| 579 | /** |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 580 | * Called from the input dispatcher thread when an application did not handle |
| 581 | * a key that was dispatched to it. |
| 582 | * |
| 583 | * <p>Allows you to define default global behavior for keys that were not handled |
| 584 | * by applications. This method is called from the input thread, with no locks held. |
| 585 | * |
| 586 | * @param win The window that currently has focus. This is where the key |
| 587 | * event will normally go. |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 588 | * @param event The key event. |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 589 | * @param policyFlags The policy flags associated with the key. |
| 590 | * @return Returns true if the policy consumed the event. |
| 591 | */ |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 592 | public boolean dispatchUnhandledKey(WindowState win, KeyEvent event, int policyFlags); |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 593 | |
| 594 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 595 | * Called when layout of the windows is about to start. |
| 596 | * |
| 597 | * @param displayWidth The current full width of the screen. |
| 598 | * @param displayHeight The current full height of the screen. |
| 599 | */ |
| 600 | public void beginLayoutLw(int displayWidth, int displayHeight); |
| 601 | |
| 602 | /** |
| 603 | * Called for each window attached to the window manager as layout is |
| 604 | * proceeding. The implementation of this function must take care of |
| 605 | * setting the window's frame, either here or in finishLayout(). |
| 606 | * |
| 607 | * @param win The window being positioned. |
| 608 | * @param attrs The LayoutParams of the window. |
| 609 | * @param attached For sub-windows, the window it is attached to; this |
| 610 | * window will already have had layoutWindow() called on it |
| 611 | * so you can use its Rect. Otherwise null. |
| 612 | */ |
| 613 | public void layoutWindowLw(WindowState win, |
| 614 | WindowManager.LayoutParams attrs, WindowState attached); |
| 615 | |
| 616 | |
| 617 | /** |
| 618 | * Return the insets for the areas covered by system windows. These values |
| 619 | * are computed on the most recent layout, so they are not guaranteed to |
| 620 | * be correct. |
| 621 | * |
| 622 | * @param attrs The LayoutParams of the window. |
| 623 | * @param contentInset The areas covered by system windows, expressed as positive insets |
| 624 | * |
| 625 | */ |
| 626 | public void getContentInsetHintLw(WindowManager.LayoutParams attrs, Rect contentInset); |
| 627 | |
| 628 | /** |
| 629 | * Called when layout of the windows is finished. After this function has |
| 630 | * returned, all windows given to layoutWindow() <em>must</em> have had a |
| 631 | * frame assigned. |
Dianne Hackborn | 7ac3f67 | 2009-03-31 18:00:53 -0700 | [diff] [blame] | 632 | * |
Dianne Hackborn | b8b11a0 | 2010-03-10 15:53:11 -0800 | [diff] [blame] | 633 | * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT}, |
| 634 | * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER}, |
| 635 | * or {@link #FINISH_LAYOUT_REDO_ANIM}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 636 | */ |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 637 | public int finishLayoutLw(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 638 | |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 639 | /** Layout state may have changed (so another layout will be performed) */ |
| 640 | static final int FINISH_LAYOUT_REDO_LAYOUT = 0x0001; |
| 641 | /** Configuration state may have changed */ |
| 642 | static final int FINISH_LAYOUT_REDO_CONFIG = 0x0002; |
| 643 | /** Wallpaper may need to move */ |
| 644 | static final int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004; |
Dianne Hackborn | b8b11a0 | 2010-03-10 15:53:11 -0800 | [diff] [blame] | 645 | /** Need to recompute animations */ |
| 646 | static final int FINISH_LAYOUT_REDO_ANIM = 0x0008; |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 647 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 648 | /** |
| 649 | * Called when animation of the windows is about to start. |
| 650 | * |
| 651 | * @param displayWidth The current full width of the screen. |
| 652 | * @param displayHeight The current full height of the screen. |
| 653 | */ |
| 654 | public void beginAnimationLw(int displayWidth, int displayHeight); |
| 655 | |
| 656 | /** |
| 657 | * Called each time a window is animating. |
| 658 | * |
| 659 | * @param win The window being positioned. |
| 660 | * @param attrs The LayoutParams of the window. |
| 661 | */ |
| 662 | public void animatingWindowLw(WindowState win, |
| 663 | WindowManager.LayoutParams attrs); |
| 664 | |
| 665 | /** |
| 666 | * Called when animation of the windows is finished. If in this function you do |
| 667 | * something that may have modified the animation state of another window, |
| 668 | * be sure to return true in order to perform another animation frame. |
| 669 | * |
Dianne Hackborn | b8b11a0 | 2010-03-10 15:53:11 -0800 | [diff] [blame] | 670 | * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT}, |
| 671 | * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER}, |
| 672 | * or {@link #FINISH_LAYOUT_REDO_ANIM}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 673 | */ |
Dianne Hackborn | b8b11a0 | 2010-03-10 15:53:11 -0800 | [diff] [blame] | 674 | public int finishAnimationLw(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 675 | |
| 676 | /** |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 677 | * Return true if it is okay to perform animations for an app transition |
| 678 | * that is about to occur. You may return false for this if, for example, |
| 679 | * the lock screen is currently displayed so the switch should happen |
| 680 | * immediately. |
| 681 | */ |
| 682 | public boolean allowAppAnimationsLw(); |
| 683 | |
| 684 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 685 | * Called after the screen turns off. |
| 686 | * |
| 687 | * @param why {@link #OFF_BECAUSE_OF_USER} or |
| 688 | * {@link #OFF_BECAUSE_OF_TIMEOUT}. |
| 689 | */ |
| 690 | public void screenTurnedOff(int why); |
| 691 | |
| 692 | /** |
| 693 | * Called after the screen turns on. |
| 694 | */ |
| 695 | public void screenTurnedOn(); |
| 696 | |
| 697 | /** |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 698 | * Return whether the screen is currently on. |
| 699 | */ |
| 700 | public boolean isScreenOn(); |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 701 | |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 702 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 703 | * Tell the policy that the lid switch has changed state. |
| 704 | * @param whenNanos The time when the change occurred in uptime nanoseconds. |
| 705 | * @param lidOpen True if the lid is now open. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 706 | */ |
Jeff Brown | 46b9ac0 | 2010-04-22 18:58:52 -0700 | [diff] [blame] | 707 | public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen); |
| 708 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 709 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 710 | * Tell the policy if anyone is requesting that keyguard not come on. |
| 711 | * |
| 712 | * @param enabled Whether keyguard can be on or not. does not actually |
| 713 | * turn it on, unless it was previously disabled with this function. |
| 714 | * |
| 715 | * @see android.app.KeyguardManager.KeyguardLock#disableKeyguard() |
| 716 | * @see android.app.KeyguardManager.KeyguardLock#reenableKeyguard() |
| 717 | */ |
| 718 | public void enableKeyguard(boolean enabled); |
| 719 | |
| 720 | /** |
| 721 | * Callback used by {@link WindowManagerPolicy#exitKeyguardSecurely} |
| 722 | */ |
| 723 | interface OnKeyguardExitResult { |
| 724 | void onKeyguardExitResult(boolean success); |
| 725 | } |
| 726 | |
| 727 | /** |
| 728 | * Tell the policy if anyone is requesting the keyguard to exit securely |
| 729 | * (this would be called after the keyguard was disabled) |
| 730 | * @param callback Callback to send the result back. |
| 731 | * @see android.app.KeyguardManager#exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult) |
| 732 | */ |
| 733 | void exitKeyguardSecurely(OnKeyguardExitResult callback); |
| 734 | |
| 735 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 736 | * inKeyguardRestrictedKeyInputMode |
| 737 | * |
| 738 | * if keyguard screen is showing or in restricted key input mode (i.e. in |
| 739 | * keyguard password emergency screen). When in such mode, certain keys, |
| 740 | * such as the Home key and the right soft keys, don't work. |
| 741 | * |
| 742 | * @return true if in keyguard restricted input mode. |
| 743 | */ |
| 744 | public boolean inKeyguardRestrictedKeyInputMode(); |
| 745 | |
| 746 | /** |
| 747 | * Given an orientation constant |
| 748 | * ({@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE |
| 749 | * ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE} or |
| 750 | * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_PORTRAIT |
| 751 | * ActivityInfo.SCREEN_ORIENTATION_PORTRAIT}), return a surface |
| 752 | * rotation. |
| 753 | */ |
The Android Open Source Project | c39a6e0 | 2009-03-11 12:11:56 -0700 | [diff] [blame] | 754 | public int rotationForOrientationLw(int orientation, int lastRotation, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 755 | boolean displayEnabled); |
| 756 | |
| 757 | /** |
Dianne Hackborn | 6af0d50 | 2009-09-28 13:25:46 -0700 | [diff] [blame] | 758 | * Called when the system is mostly done booting to determine whether |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 759 | * the system should go into safe mode. |
| 760 | */ |
| 761 | public boolean detectSafeMode(); |
| 762 | |
| 763 | /** |
| 764 | * Called when the system is mostly done booting. |
| 765 | */ |
| 766 | public void systemReady(); |
| 767 | |
| 768 | /** |
Mike Lockwood | ef73162 | 2010-01-27 17:51:34 -0500 | [diff] [blame] | 769 | * Called when userActivity is signalled in the power manager. |
| 770 | * This is safe to call from any thread, with any window manager locks held or not. |
| 771 | */ |
| 772 | public void userActivity(); |
| 773 | |
| 774 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 775 | * Called when we have finished booting and can now display the home |
| 776 | * screen to the user. This wilWl happen after systemReady(), and at |
| 777 | * this point the display is active. |
| 778 | */ |
| 779 | public void enableScreenAfterBoot(); |
| 780 | |
The Android Open Source Project | c39a6e0 | 2009-03-11 12:11:56 -0700 | [diff] [blame] | 781 | public void setCurrentOrientationLw(int newOrientation); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 782 | |
| 783 | /** |
| 784 | * Call from application to perform haptic feedback on its window. |
| 785 | */ |
The Android Open Source Project | c39a6e0 | 2009-03-11 12:11:56 -0700 | [diff] [blame] | 786 | public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 787 | |
| 788 | /** |
| 789 | * Called when we have stopped keeping the screen on because a window |
| 790 | * requesting this is no longer visible. |
| 791 | */ |
The Android Open Source Project | c39a6e0 | 2009-03-11 12:11:56 -0700 | [diff] [blame] | 792 | public void screenOnStoppedLw(); |
Mike Lockwood | 3d0ea72 | 2009-10-21 22:58:29 -0400 | [diff] [blame] | 793 | |
| 794 | /** |
| 795 | * Return false to disable key repeat events from being generated. |
| 796 | */ |
| 797 | public boolean allowKeyRepeat(); |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 798 | |
| 799 | /** |
| 800 | * Inform the policy that the user has chosen a preferred orientation ("rotation lock"). |
| 801 | * |
| 802 | * @param mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or |
| 803 | * {@link * WindowManagerPolicy#USER_ROTATION_FREE}. |
| 804 | * @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90}, |
| 805 | * {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}. |
| 806 | */ |
| 807 | public void setUserRotationMode(int mode, int rotation); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 808 | } |