blob: c7cd662d2c276f94de588aba80fdbd7566887d3c [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.view;
18
19import android.content.Context;
Dianne Hackborn2f0b1752011-05-31 17:59:49 -070020import android.content.res.CompatibilityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.content.res.Configuration;
22import android.graphics.Rect;
Dianne Hackbornd040edb2011-08-31 12:47:58 -070023import android.graphics.RectF;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.os.IBinder;
25import android.os.LocalPowerManager;
Dianne Hackborndf89e652011-10-06 22:35:11 -070026import android.os.Looper;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.view.animation.Animation;
28
Dianne Hackbornf99f9c52011-01-12 15:49:25 -080029import java.io.FileDescriptor;
30import java.io.PrintWriter;
31
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032/**
33 * This interface supplies all UI-specific behavior of the window manager. An
34 * instance of it is created by the window manager when it starts up, and allows
35 * customization of window layering, special window types, key dispatching, and
36 * layout.
37 *
38 * <p>Because this provides deep interaction with the system window manager,
39 * specific methods on this interface can be called from a variety of contexts
40 * with various restrictions on what they can do. These are encoded through
41 * a suffixes at the end of a method encoding the thread the method is called
42 * from and any locks that are held when it is being called; if no suffix
43 * is attached to a method, then it is not called with any locks and may be
44 * called from the main window manager thread or another thread calling into
45 * the window manager.
46 *
47 * <p>The current suffixes are:
48 *
49 * <dl>
50 * <dt> Ti <dd> Called from the input thread. This is the thread that
51 * collects pending input events and dispatches them to the appropriate window.
52 * It may block waiting for events to be processed, so that the input stream is
53 * properly serialized.
54 * <dt> Tq <dd> Called from the low-level input queue thread. This is the
55 * thread that reads events out of the raw input devices and places them
56 * into the global input queue that is read by the <var>Ti</var> thread.
57 * This thread should not block for a long period of time on anything but the
58 * key driver.
59 * <dt> Lw <dd> Called with the main window manager lock held. Because the
60 * window manager is a very low-level system service, there are few other
61 * system services you can call with this lock held. It is explicitly okay to
62 * make calls into the package manager and power manager; it is explicitly not
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -070063 * okay to make calls into the activity manager or most other services. Note that
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064 * {@link android.content.Context#checkPermission(String, int, int)} and
65 * variations require calling into the activity manager.
66 * <dt> Li <dd> Called with the input thread lock held. This lock can be
67 * acquired by the window manager while it holds the window lock, so this is
68 * even more restrictive than <var>Lw</var>.
69 * </dl>
70 *
71 * @hide
72 */
73public interface WindowManagerPolicy {
Jeff Brownb6997262010-10-08 22:31:17 -070074 // Policy flags. These flags are also defined in frameworks/base/include/ui/Input.h.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 public final static int FLAG_WAKE = 0x00000001;
76 public final static int FLAG_WAKE_DROPPED = 0x00000002;
77 public final static int FLAG_SHIFT = 0x00000004;
78 public final static int FLAG_CAPS_LOCK = 0x00000008;
79 public final static int FLAG_ALT = 0x00000010;
80 public final static int FLAG_ALT_GR = 0x00000020;
81 public final static int FLAG_MENU = 0x00000040;
82 public final static int FLAG_LAUNCHER = 0x00000080;
Jeff Brown0eaf3932010-10-01 14:55:30 -070083 public final static int FLAG_VIRTUAL = 0x00000100;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080084
Jeff Brown85a31762010-09-01 17:01:00 -070085 public final static int FLAG_INJECTED = 0x01000000;
Jeff Browne20c9e02010-10-11 14:20:19 -070086 public final static int FLAG_TRUSTED = 0x02000000;
Jeff Brown0029c662011-03-30 02:25:18 -070087 public final static int FLAG_FILTERED = 0x04000000;
88 public final static int FLAG_DISABLE_KEY_REPEAT = 0x08000000;
Jeff Brown85a31762010-09-01 17:01:00 -070089
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080090 public final static int FLAG_WOKE_HERE = 0x10000000;
91 public final static int FLAG_BRIGHT_HERE = 0x20000000;
Jeff Brownb6997262010-10-08 22:31:17 -070092 public final static int FLAG_PASS_TO_USER = 0x40000000;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093
94 public final static boolean WATCH_POINTER = false;
95
Dianne Hackbornad7fa7f2011-01-07 14:06:50 -080096 /**
97 * Sticky broadcast of the current HDMI plugged state.
98 */
99 public final static String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED";
100
101 /**
102 * Extra in {@link #ACTION_HDMI_PLUGGED} indicating the state: true if
103 * plugged in to HDMI, false if not.
104 */
105 public final static String EXTRA_HDMI_PLUGGED_STATE = "state";
106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 /**
Jeff Brownd5bb82d2011-10-12 13:57:59 -0700108 * Pass this event to the user / app. To be returned from
109 * {@link #interceptKeyBeforeQueueing}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 */
111 public final static int ACTION_PASS_TO_USER = 0x00000001;
112
113 /**
114 * This key event should extend the user activity timeout and turn the lights on.
Jeff Brownd5bb82d2011-10-12 13:57:59 -0700115 * To be returned from {@link #interceptKeyBeforeQueueing}.
116 * Do not return this and {@link #ACTION_GO_TO_SLEEP} or {@link #ACTION_PASS_TO_USER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 */
118 public final static int ACTION_POKE_USER_ACTIVITY = 0x00000002;
119
120 /**
121 * This key event should put the device to sleep (and engage keyguard if necessary)
Jeff Brownd5bb82d2011-10-12 13:57:59 -0700122 * To be returned from {@link #interceptKeyBeforeQueueing}.
123 * Do not return this and {@link #ACTION_POKE_USER_ACTIVITY} or {@link #ACTION_PASS_TO_USER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 */
125 public final static int ACTION_GO_TO_SLEEP = 0x00000004;
126
127 /**
128 * Interface to the Window Manager state associated with a particular
129 * window. You can hold on to an instance of this interface from the call
130 * to prepareAddWindow() until removeWindow().
131 */
132 public interface WindowState {
133 /**
134 * Perform standard frame computation. The result can be obtained with
135 * getFrame() if so desired. Must be called with the window manager
136 * lock held.
137 *
138 * @param parentFrame The frame of the parent container this window
139 * is in, used for computing its basic position.
140 * @param displayFrame The frame of the overall display in which this
141 * window can appear, used for constraining the overall dimensions
142 * of the window.
143 * @param contentFrame The frame within the display in which we would
144 * like active content to appear. This will cause windows behind to
145 * be resized to match the given content frame.
146 * @param visibleFrame The frame within the display that the window
147 * is actually visible, used for computing its visible insets to be
148 * given to windows behind.
149 * This can be used as a hint for scrolling (avoiding resizing)
150 * the window to make certain that parts of its content
151 * are visible.
152 */
153 public void computeFrameLw(Rect parentFrame, Rect displayFrame,
154 Rect contentFrame, Rect visibleFrame);
155
156 /**
157 * Retrieve the current frame of the window that has been assigned by
158 * the window manager. Must be called with the window manager lock held.
159 *
160 * @return Rect The rectangle holding the window frame.
161 */
162 public Rect getFrameLw();
163
164 /**
165 * Retrieve the current frame of the window that is actually shown.
166 * Must be called with the window manager lock held.
167 *
168 * @return Rect The rectangle holding the shown window frame.
169 */
Dianne Hackbornd040edb2011-08-31 12:47:58 -0700170 public RectF getShownFrameLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800171
172 /**
173 * Retrieve the frame of the display that this window was last
174 * laid out in. Must be called with the
175 * window manager lock held.
176 *
177 * @return Rect The rectangle holding the display frame.
178 */
179 public Rect getDisplayFrameLw();
180
181 /**
182 * Retrieve the frame of the content area that this window was last
183 * laid out in. This is the area in which the content of the window
184 * should be placed. It will be smaller than the display frame to
185 * account for screen decorations such as a status bar or soft
186 * keyboard. Must be called with the
187 * window manager lock held.
188 *
189 * @return Rect The rectangle holding the content frame.
190 */
191 public Rect getContentFrameLw();
192
193 /**
194 * Retrieve the frame of the visible area that this window was last
195 * laid out in. This is the area of the screen in which the window
196 * will actually be fully visible. It will be smaller than the
197 * content frame to account for transient UI elements blocking it
198 * such as an input method's candidates UI. Must be called with the
199 * window manager lock held.
200 *
201 * @return Rect The rectangle holding the visible frame.
202 */
203 public Rect getVisibleFrameLw();
204
205 /**
206 * Returns true if this window is waiting to receive its given
207 * internal insets from the client app, and so should not impact the
208 * layout of other windows.
209 */
210 public boolean getGivenInsetsPendingLw();
211
212 /**
213 * Retrieve the insets given by this window's client for the content
214 * area of windows behind it. Must be called with the
215 * window manager lock held.
216 *
217 * @return Rect The left, top, right, and bottom insets, relative
218 * to the window's frame, of the actual contents.
219 */
220 public Rect getGivenContentInsetsLw();
221
222 /**
223 * Retrieve the insets given by this window's client for the visible
224 * area of windows behind it. Must be called with the
225 * window manager lock held.
226 *
227 * @return Rect The left, top, right, and bottom insets, relative
228 * to the window's frame, of the actual visible area.
229 */
230 public Rect getGivenVisibleInsetsLw();
231
232 /**
233 * Retrieve the current LayoutParams of the window.
234 *
235 * @return WindowManager.LayoutParams The window's internal LayoutParams
236 * instance.
237 */
238 public WindowManager.LayoutParams getAttrs();
239
240 /**
Dianne Hackborn73ab6a42011-12-13 11:16:23 -0800241 * Return whether this window needs the menu key shown. Must be called
242 * with window lock held, because it may need to traverse down through
243 * window list to determine the result.
244 * @param bottom The bottom-most window to consider when determining this.
245 */
246 public boolean getNeedsMenuLw(WindowState bottom);
247
248 /**
Dianne Hackborn9a230e02011-10-06 11:51:27 -0700249 * Retrieve the current system UI visibility flags associated with
250 * this window.
251 */
252 public int getSystemUiVisibility();
253
254 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 * Get the layer at which this window's surface will be Z-ordered.
256 */
257 public int getSurfaceLayer();
258
259 /**
260 * Return the token for the application (actually activity) that owns
261 * this window. May return null for system windows.
262 *
263 * @return An IApplicationToken identifying the owning activity.
264 */
265 public IApplicationToken getAppToken();
266
267 /**
268 * Return true if, at any point, the application token associated with
269 * this window has actually displayed any windows. This is most useful
270 * with the "starting up" window to determine if any windows were
271 * displayed when it is closed.
272 *
273 * @return Returns true if one or more windows have been displayed,
274 * else false.
275 */
276 public boolean hasAppShownWindows();
277
278 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800279 * Is this window visible? It is not visible if there is no
280 * surface, or we are in the process of running an exit animation
281 * that will remove the surface.
282 */
283 boolean isVisibleLw();
284
285 /**
Dianne Hackborn3d163f072009-10-07 21:26:57 -0700286 * Like {@link #isVisibleLw}, but also counts a window that is currently
287 * "hidden" behind the keyguard as visible. This allows us to apply
288 * things like window flags that impact the keyguard.
289 */
290 boolean isVisibleOrBehindKeyguardLw();
291
292 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800293 * Is this window currently visible to the user on-screen? It is
294 * displayed either if it is visible or it is currently running an
295 * animation before no longer being visible. Must be called with the
296 * window manager lock held.
297 */
298 boolean isDisplayedLw();
299
300 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800301 * Returns true if this window has been shown on screen at some time in
302 * the past. Must be called with the window manager lock held.
303 *
304 * @return boolean
305 */
306 public boolean hasDrawnLw();
307
308 /**
309 * Can be called by the policy to force a window to be hidden,
310 * regardless of whether the client or window manager would like
311 * it shown. Must be called with the window manager lock held.
312 * Returns true if {@link #showLw} was last called for the window.
313 */
314 public boolean hideLw(boolean doAnimation);
315
316 /**
317 * Can be called to undo the effect of {@link #hideLw}, allowing a
318 * window to be shown as long as the window manager and client would
319 * also like it to be shown. Must be called with the window manager
320 * lock held.
321 * Returns true if {@link #hideLw} was last called for the window.
322 */
323 public boolean showLw(boolean doAnimation);
324 }
325
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700326 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700327 * Representation of a "fake window" that the policy has added to the
328 * window manager to consume events.
329 */
330 public interface FakeWindow {
331 /**
332 * Remove the fake window from the window manager.
333 */
334 void dismiss();
335 }
336
337 /**
338 * Interface for calling back in to the window manager that is private
339 * between it and the policy.
340 */
341 public interface WindowManagerFuncs {
342 /**
343 * Ask the window manager to re-evaluate the system UI flags.
344 */
345 public void reevaluateStatusBarVisibility();
346
347 /**
348 * Add a fake window to the window manager. This window sits
349 * at the top of the other windows and consumes events.
350 */
Jeff Brown32cbc38552011-12-01 14:01:49 -0800351 public FakeWindow addFakeWindow(Looper looper,
352 InputEventReceiver.Factory inputEventReceiverFactory,
Dianne Hackborndf89e652011-10-06 22:35:11 -0700353 String name, int windowType, int layoutParamsFlags, boolean canReceiveKeys,
354 boolean hasFocus, boolean touchFullscreen);
355 }
356
357 /**
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700358 * Bit mask that is set for all enter transition.
359 */
360 public final int TRANSIT_ENTER_MASK = 0x1000;
361
362 /**
363 * Bit mask that is set for all exit transitions.
364 */
365 public final int TRANSIT_EXIT_MASK = 0x2000;
366
Dianne Hackbornbfe319e2009-09-21 00:34:05 -0700367 /** Not set up for a transition. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700368 public final int TRANSIT_UNSET = -1;
Dianne Hackbornbfe319e2009-09-21 00:34:05 -0700369 /** No animation for transition. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 public final int TRANSIT_NONE = 0;
371 /** Window has been added to the screen. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700372 public final int TRANSIT_ENTER = 1 | TRANSIT_ENTER_MASK;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800373 /** Window has been removed from the screen. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700374 public final int TRANSIT_EXIT = 2 | TRANSIT_EXIT_MASK;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800375 /** Window has been made visible. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700376 public final int TRANSIT_SHOW = 3 | TRANSIT_ENTER_MASK;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800377 /** Window has been made invisible. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700378 public final int TRANSIT_HIDE = 4 | TRANSIT_EXIT_MASK;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800379 /** The "application starting" preview window is no longer needed, and will
380 * animate away to show the real window. */
381 public final int TRANSIT_PREVIEW_DONE = 5;
382 /** A window in a new activity is being opened on top of an existing one
383 * in the same task. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700384 public final int TRANSIT_ACTIVITY_OPEN = 6 | TRANSIT_ENTER_MASK;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 /** The window in the top-most activity is being closed to reveal the
386 * previous activity in the same task. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700387 public final int TRANSIT_ACTIVITY_CLOSE = 7 | TRANSIT_EXIT_MASK;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800388 /** A window in a new task is being opened on top of an existing one
389 * in another activity's task. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700390 public final int TRANSIT_TASK_OPEN = 8 | TRANSIT_ENTER_MASK;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800391 /** A window in the top-most activity is being closed to reveal the
392 * previous activity in a different task. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700393 public final int TRANSIT_TASK_CLOSE = 9 | TRANSIT_EXIT_MASK;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800394 /** A window in an existing task is being displayed on top of an existing one
395 * in another activity's task. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700396 public final int TRANSIT_TASK_TO_FRONT = 10 | TRANSIT_ENTER_MASK;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800397 /** A window in an existing task is being put below all other tasks. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700398 public final int TRANSIT_TASK_TO_BACK = 11 | TRANSIT_EXIT_MASK;
Dianne Hackborn25994b42009-09-04 14:21:19 -0700399 /** A window in a new activity that doesn't have a wallpaper is being
400 * opened on top of one that does, effectively closing the wallpaper. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700401 public final int TRANSIT_WALLPAPER_CLOSE = 12 | TRANSIT_EXIT_MASK;
Dianne Hackborn25994b42009-09-04 14:21:19 -0700402 /** A window in a new activity that does have a wallpaper is being
403 * opened on one that didn't, effectively opening the wallpaper. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700404 public final int TRANSIT_WALLPAPER_OPEN = 13 | TRANSIT_ENTER_MASK;
Dianne Hackbornf8fbdb62009-08-19 12:39:43 -0700405 /** A window in a new activity is being opened on top of an existing one,
406 * and both are on top of the wallpaper. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700407 public final int TRANSIT_WALLPAPER_INTRA_OPEN = 14 | TRANSIT_ENTER_MASK;
Dianne Hackbornf8fbdb62009-08-19 12:39:43 -0700408 /** The window in the top-most activity is being closed to reveal the
409 * previous activity, and both are on top of he wallpaper. */
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700410 public final int TRANSIT_WALLPAPER_INTRA_CLOSE = 15 | TRANSIT_EXIT_MASK;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411
Dianne Hackborn254cb442010-01-27 19:23:59 -0800412 // NOTE: screen off reasons are in order of significance, with more
413 // important ones lower than less important ones.
414
415 /** Screen turned off because of a device admin */
416 public final int OFF_BECAUSE_OF_ADMIN = 1;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800417 /** Screen turned off because of power button */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800418 public final int OFF_BECAUSE_OF_USER = 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 /** Screen turned off because of timeout */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800420 public final int OFF_BECAUSE_OF_TIMEOUT = 3;
Mike Lockwood435eb642009-12-03 08:40:18 -0500421 /** Screen turned off because of proximity sensor */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800422 public final int OFF_BECAUSE_OF_PROX_SENSOR = 4;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400424 /** When not otherwise specified by the activity's screenOrientation, rotation should be
425 * determined by the system (that is, using sensors). */
426 public final int USER_ROTATION_FREE = 0;
427 /** When not otherwise specified by the activity's screenOrientation, rotation is set by
428 * the user. */
429 public final int USER_ROTATION_LOCKED = 1;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800430
431 /**
432 * Perform initialization of the policy.
433 *
434 * @param context The system context we are running in.
435 * @param powerManager
436 */
437 public void init(Context context, IWindowManager windowManager,
Dianne Hackborndf89e652011-10-06 22:35:11 -0700438 WindowManagerFuncs windowManagerFuncs,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800439 LocalPowerManager powerManager);
440
441 /**
Dianne Hackborn9d132642011-04-21 17:26:39 -0700442 * Called by window manager once it has the initial, default native
443 * display dimensions.
444 */
445 public void setInitialDisplaySize(int width, int height);
Dianne Hackborndacea8c2011-04-21 17:26:39 -0700446
Dianne Hackborn9d132642011-04-21 17:26:39 -0700447 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800448 * Check permissions when adding a window.
449 *
450 * @param attrs The window's LayoutParams.
451 *
452 * @return {@link WindowManagerImpl#ADD_OKAY} if the add can proceed;
453 * else an error code, usually
454 * {@link WindowManagerImpl#ADD_PERMISSION_DENIED}, to abort the add.
455 */
456 public int checkAddPermission(WindowManager.LayoutParams attrs);
457
458 /**
459 * Sanitize the layout parameters coming from a client. Allows the policy
460 * to do things like ensure that windows of a specific type can't take
461 * input focus.
462 *
463 * @param attrs The window layout parameters to be modified. These values
464 * are modified in-place.
465 */
466 public void adjustWindowParamsLw(WindowManager.LayoutParams attrs);
467
468 /**
469 * After the window manager has computed the current configuration based
470 * on its knowledge of the display and input devices, it gives the policy
471 * a chance to adjust the information contained in it. If you want to
472 * leave it as-is, simply do nothing.
473 *
474 * <p>This method may be called by any thread in the window manager, but
475 * no internal locks in the window manager will be held.
476 *
477 * @param config The Configuration being computed, for you to change as
478 * desired.
479 */
480 public void adjustConfigurationLw(Configuration config);
481
482 /**
483 * Assign a window type to a layer. Allows you to control how different
484 * kinds of windows are ordered on-screen.
485 *
486 * @param type The type of window being assigned.
487 *
488 * @return int An arbitrary integer used to order windows, with lower
489 * numbers below higher ones.
490 */
491 public int windowTypeToLayerLw(int type);
492
493 /**
494 * Return how to Z-order sub-windows in relation to the window they are
495 * attached to. Return positive to have them ordered in front, negative for
496 * behind.
497 *
498 * @param type The sub-window type code.
499 *
500 * @return int Layer in relation to the attached window, where positive is
501 * above and negative is below.
502 */
503 public int subWindowTypeToLayerLw(int type);
504
505 /**
Dianne Hackborn6136b7e2009-09-18 01:53:49 -0700506 * Get the highest layer (actually one more than) that the wallpaper is
507 * allowed to be in.
508 */
509 public int getMaxWallpaperLayer();
510
511 /**
Dianne Hackborn81e56d52011-05-26 00:55:58 -0700512 * Return true if the policy allows the status bar to hide. Otherwise,
513 * it is a tablet-style system bar.
514 */
515 public boolean canStatusBarHide();
516
517 /**
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700518 * Return the display width available after excluding any screen
519 * decorations that can never be removed. That is, system bar or
520 * button bar.
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400521 */
Dianne Hackborn1f903c32011-09-13 19:18:06 -0700522 public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400523
524 /**
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700525 * Return the display height available after excluding any screen
526 * decorations that can never be removed. That is, system bar or
527 * button bar.
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400528 */
Dianne Hackborn1f903c32011-09-13 19:18:06 -0700529 public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation);
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700530
531 /**
532 * Return the available screen width that we should report for the
533 * configuration. This must be no larger than
534 * {@link #getNonDecorDisplayWidth(int, int)}; it may be smaller than
535 * that to account for more transient decoration like a status bar.
536 */
Dianne Hackborn1f903c32011-09-13 19:18:06 -0700537 public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation);
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700538
539 /**
540 * Return the available screen height that we should report for the
541 * configuration. This must be no larger than
542 * {@link #getNonDecorDisplayHeight(int, int)}; it may be smaller than
543 * that to account for more transient decoration like a status bar.
544 */
Dianne Hackborn1f903c32011-09-13 19:18:06 -0700545 public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400546
547 /**
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700548 * Return whether the given window should forcibly hide everything
549 * behind it. Typically returns true for the keyguard.
550 */
551 public boolean doesForceHide(WindowState win, WindowManager.LayoutParams attrs);
552
553 /**
554 * Determine if a window that is behind one that is force hiding
555 * (as determined by {@link #doesForceHide}) should actually be hidden.
556 * For example, typically returns false for the status bar. Be careful
557 * to return false for any window that you may hide yourself, since this
558 * will conflict with what you set.
559 */
560 public boolean canBeForceHidden(WindowState win, WindowManager.LayoutParams attrs);
561
562 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800563 * Called when the system would like to show a UI to indicate that an
564 * application is starting. You can use this to add a
565 * APPLICATION_STARTING_TYPE window with the given appToken to the window
566 * manager (using the normal window manager APIs) that will be shown until
567 * the application displays its own window. This is called without the
568 * window manager locked so that you can call back into it.
569 *
570 * @param appToken Token of the application being started.
571 * @param packageName The name of the application package being started.
572 * @param theme Resource defining the application's overall visual theme.
573 * @param nonLocalizedLabel The default title label of the application if
574 * no data is found in the resource.
575 * @param labelRes The resource ID the application would like to use as its name.
576 * @param icon The resource ID the application would like to use as its icon.
Dianne Hackborn7eec10e2010-11-12 18:03:47 -0800577 * @param windowFlags Window layout flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 *
579 * @return Optionally you can return the View that was used to create the
580 * window, for easy removal in removeStartingWindow.
581 *
582 * @see #removeStartingWindow
583 */
584 public View addStartingWindow(IBinder appToken, String packageName,
Dianne Hackborn2f0b1752011-05-31 17:59:49 -0700585 int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel,
Dianne Hackborn7eec10e2010-11-12 18:03:47 -0800586 int labelRes, int icon, int windowFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800587
588 /**
589 * Called when the first window of an application has been displayed, while
590 * {@link #addStartingWindow} has created a temporary initial window for
591 * that application. You should at this point remove the window from the
592 * window manager. This is called without the window manager locked so
593 * that you can call back into it.
594 *
595 * <p>Note: due to the nature of these functions not being called with the
596 * window manager locked, you must be prepared for this function to be
597 * called multiple times and/or an initial time with a null View window
598 * even if you previously returned one.
599 *
600 * @param appToken Token of the application that has started.
601 * @param window Window View that was returned by createStartingWindow.
602 *
603 * @see #addStartingWindow
604 */
605 public void removeStartingWindow(IBinder appToken, View window);
606
607 /**
608 * Prepare for a window being added to the window manager. You can throw an
609 * exception here to prevent the window being added, or do whatever setup
610 * you need to keep track of the window.
611 *
612 * @param win The window being added.
613 * @param attrs The window's LayoutParams.
614 *
615 * @return {@link WindowManagerImpl#ADD_OKAY} if the add can proceed, else an
616 * error code to abort the add.
617 */
618 public int prepareAddWindowLw(WindowState win,
619 WindowManager.LayoutParams attrs);
620
621 /**
622 * Called when a window is being removed from a window manager. Must not
623 * throw an exception -- clean up as much as possible.
624 *
625 * @param win The window being removed.
626 */
627 public void removeWindowLw(WindowState win);
628
629 /**
630 * Control the animation to run when a window's state changes. Return a
631 * non-0 number to force the animation to a specific resource ID, or 0
632 * to use the default animation.
633 *
634 * @param win The window that is changing.
635 * @param transit What is happening to the window: {@link #TRANSIT_ENTER},
636 * {@link #TRANSIT_EXIT}, {@link #TRANSIT_SHOW}, or
637 * {@link #TRANSIT_HIDE}.
638 *
639 * @return Resource ID of the actual animation to use, or 0 for none.
640 */
641 public int selectAnimationLw(WindowState win, int transit);
642
643 /**
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700644 * Create and return an animation to re-display a force hidden window.
645 */
646 public Animation createForceHideEnterAnimation();
647
648 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -0700649 * Called from the input reader thread before a key is enqueued.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800650 *
651 * <p>There are some actions that need to be handled here because they
652 * affect the power state of the device, for example, the power keys.
653 * Generally, it's best to keep as little as possible in the queue thread
654 * because it's the most fragile.
Jeff Brown1f245102010-11-18 20:53:46 -0800655 * @param event The key event.
Jeff Brown00fa7bd2010-07-02 15:37:36 -0700656 * @param policyFlags The policy flags associated with the key.
657 * @param isScreenOn True if the screen is already on
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800658 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800659 * @return The bitwise or of the {@link #ACTION_PASS_TO_USER},
660 * {@link #ACTION_POKE_USER_ACTIVITY} and {@link #ACTION_GO_TO_SLEEP} flags.
661 */
Jeff Brown1f245102010-11-18 20:53:46 -0800662 public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn);
Jeff Brown56194eb2011-03-02 19:23:13 -0800663
664 /**
665 * Called from the input reader thread before a motion is enqueued when the screen is off.
666 *
667 * <p>There are some actions that need to be handled here because they
668 * affect the power state of the device, for example, waking on motions.
669 * Generally, it's best to keep as little as possible in the queue thread
670 * because it's the most fragile.
671 * @param policyFlags The policy flags associated with the motion.
672 *
673 * @return The bitwise or of the {@link #ACTION_PASS_TO_USER},
674 * {@link #ACTION_POKE_USER_ACTIVITY} and {@link #ACTION_GO_TO_SLEEP} flags.
675 */
676 public int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags);
677
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -0700679 * Called from the input dispatcher thread before a key is dispatched to a window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800680 *
681 * <p>Allows you to define
Jeff Brown3915bb82010-11-05 15:02:16 -0700682 * behavior for keys that can not be overridden by applications.
683 * This method is called from the input thread, with no locks held.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800684 *
685 * @param win The window that currently has focus. This is where the key
686 * event will normally go.
Jeff Brown1f245102010-11-18 20:53:46 -0800687 * @param event The key event.
Jeff Brown00fa7bd2010-07-02 15:37:36 -0700688 * @param policyFlags The policy flags associated with the key.
Jeff Brownd5bb82d2011-10-12 13:57:59 -0700689 * @return 0 if the key should be dispatched immediately, -1 if the key should
690 * not be dispatched ever, or a positive value indicating the number of
691 * milliseconds by which the key dispatch should be delayed before trying
692 * again.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800693 */
Jeff Brownd5bb82d2011-10-12 13:57:59 -0700694 public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800695
696 /**
Jeff Brown3915bb82010-11-05 15:02:16 -0700697 * Called from the input dispatcher thread when an application did not handle
698 * a key that was dispatched to it.
699 *
700 * <p>Allows you to define default global behavior for keys that were not handled
701 * by applications. This method is called from the input thread, with no locks held.
702 *
703 * @param win The window that currently has focus. This is where the key
704 * event will normally go.
Jeff Brown1f245102010-11-18 20:53:46 -0800705 * @param event The key event.
Jeff Brown3915bb82010-11-05 15:02:16 -0700706 * @param policyFlags The policy flags associated with the key.
Jeff Brown49ed71d2010-12-06 17:13:33 -0800707 * @return Returns an alternate key event to redispatch as a fallback, or null to give up.
708 * The caller is responsible for recycling the key event.
Jeff Brown3915bb82010-11-05 15:02:16 -0700709 */
Jeff Brown49ed71d2010-12-06 17:13:33 -0800710 public KeyEvent dispatchUnhandledKey(WindowState win, KeyEvent event, int policyFlags);
Jeff Brown3915bb82010-11-05 15:02:16 -0700711
712 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800713 * Called when layout of the windows is about to start.
714 *
715 * @param displayWidth The current full width of the screen.
716 * @param displayHeight The current full height of the screen.
Dianne Hackborn1f903c32011-09-13 19:18:06 -0700717 * @param displayRotation The current rotation being applied to the base
718 * window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800719 */
Dianne Hackborn1f903c32011-09-13 19:18:06 -0700720 public void beginLayoutLw(int displayWidth, int displayHeight, int displayRotation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721
722 /**
723 * Called for each window attached to the window manager as layout is
724 * proceeding. The implementation of this function must take care of
725 * setting the window's frame, either here or in finishLayout().
726 *
727 * @param win The window being positioned.
728 * @param attrs The LayoutParams of the window.
729 * @param attached For sub-windows, the window it is attached to; this
730 * window will already have had layoutWindow() called on it
731 * so you can use its Rect. Otherwise null.
732 */
733 public void layoutWindowLw(WindowState win,
734 WindowManager.LayoutParams attrs, WindowState attached);
735
736
737 /**
738 * Return the insets for the areas covered by system windows. These values
739 * are computed on the most recent layout, so they are not guaranteed to
740 * be correct.
741 *
742 * @param attrs The LayoutParams of the window.
743 * @param contentInset The areas covered by system windows, expressed as positive insets
744 *
745 */
746 public void getContentInsetHintLw(WindowManager.LayoutParams attrs, Rect contentInset);
747
748 /**
749 * Called when layout of the windows is finished. After this function has
750 * returned, all windows given to layoutWindow() <em>must</em> have had a
751 * frame assigned.
Dianne Hackborn7ac3f672009-03-31 18:00:53 -0700752 *
Dianne Hackbornb8b11a02010-03-10 15:53:11 -0800753 * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT},
754 * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER},
755 * or {@link #FINISH_LAYOUT_REDO_ANIM}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800756 */
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700757 public int finishLayoutLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800758
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700759 /** Layout state may have changed (so another layout will be performed) */
760 static final int FINISH_LAYOUT_REDO_LAYOUT = 0x0001;
761 /** Configuration state may have changed */
762 static final int FINISH_LAYOUT_REDO_CONFIG = 0x0002;
763 /** Wallpaper may need to move */
764 static final int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004;
Dianne Hackbornb8b11a02010-03-10 15:53:11 -0800765 /** Need to recompute animations */
766 static final int FINISH_LAYOUT_REDO_ANIM = 0x0008;
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700767
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800768 /**
769 * Called when animation of the windows is about to start.
770 *
771 * @param displayWidth The current full width of the screen.
772 * @param displayHeight The current full height of the screen.
773 */
774 public void beginAnimationLw(int displayWidth, int displayHeight);
775
776 /**
777 * Called each time a window is animating.
778 *
779 * @param win The window being positioned.
780 * @param attrs The LayoutParams of the window.
781 */
782 public void animatingWindowLw(WindowState win,
783 WindowManager.LayoutParams attrs);
784
785 /**
786 * Called when animation of the windows is finished. If in this function you do
787 * something that may have modified the animation state of another window,
788 * be sure to return true in order to perform another animation frame.
789 *
Dianne Hackbornb8b11a02010-03-10 15:53:11 -0800790 * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT},
791 * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER},
792 * or {@link #FINISH_LAYOUT_REDO_ANIM}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800793 */
Dianne Hackbornb8b11a02010-03-10 15:53:11 -0800794 public int finishAnimationLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800795
796 /**
Dianne Hackbornde2606d2009-12-18 16:53:55 -0800797 * Return true if it is okay to perform animations for an app transition
798 * that is about to occur. You may return false for this if, for example,
799 * the lock screen is currently displayed so the switch should happen
800 * immediately.
801 */
802 public boolean allowAppAnimationsLw();
Joe Onorato664644d2011-01-23 17:53:23 -0800803
804
805 /**
806 * A new window has been focused.
807 */
Dianne Hackborndf89e652011-10-06 22:35:11 -0700808 public int focusChangedLw(WindowState lastFocus, WindowState newFocus);
Dianne Hackbornde2606d2009-12-18 16:53:55 -0800809
810 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800811 * Called after the screen turns off.
812 *
813 * @param why {@link #OFF_BECAUSE_OF_USER} or
814 * {@link #OFF_BECAUSE_OF_TIMEOUT}.
815 */
816 public void screenTurnedOff(int why);
817
Dianne Hackborn38e29a62011-09-18 14:43:08 -0700818 public interface ScreenOnListener {
819 void onScreenOn();
820 };
821
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800822 /**
Dianne Hackborn38e29a62011-09-18 14:43:08 -0700823 * Called when the power manager would like to turn the screen on.
824 * Must call back on the listener to tell it when the higher-level system
825 * is ready for the screen to go on (i.e. the lock screen is shown).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800826 */
Dianne Hackborn38e29a62011-09-18 14:43:08 -0700827 public void screenTurningOn(ScreenOnListener screenOnListener);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800828
829 /**
Dianne Hackbornbc1aa7b2011-09-20 11:20:31 -0700830 * Return whether the screen is about to turn on or is currently on.
Dianne Hackbornde2606d2009-12-18 16:53:55 -0800831 */
Dianne Hackbornbc1aa7b2011-09-20 11:20:31 -0700832 public boolean isScreenOnEarly();
833
834 /**
835 * Return whether the screen is fully turned on.
836 */
837 public boolean isScreenOnFully();
Jeff Brown00fa7bd2010-07-02 15:37:36 -0700838
Dianne Hackbornde2606d2009-12-18 16:53:55 -0800839 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -0700840 * Tell the policy that the lid switch has changed state.
841 * @param whenNanos The time when the change occurred in uptime nanoseconds.
842 * @param lidOpen True if the lid is now open.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800843 */
Jeff Brown46b9ac02010-04-22 18:58:52 -0700844 public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen);
845
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800846 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800847 * Tell the policy if anyone is requesting that keyguard not come on.
848 *
849 * @param enabled Whether keyguard can be on or not. does not actually
850 * turn it on, unless it was previously disabled with this function.
851 *
852 * @see android.app.KeyguardManager.KeyguardLock#disableKeyguard()
853 * @see android.app.KeyguardManager.KeyguardLock#reenableKeyguard()
854 */
855 public void enableKeyguard(boolean enabled);
856
857 /**
858 * Callback used by {@link WindowManagerPolicy#exitKeyguardSecurely}
859 */
860 interface OnKeyguardExitResult {
861 void onKeyguardExitResult(boolean success);
862 }
863
864 /**
865 * Tell the policy if anyone is requesting the keyguard to exit securely
866 * (this would be called after the keyguard was disabled)
867 * @param callback Callback to send the result back.
868 * @see android.app.KeyguardManager#exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult)
869 */
870 void exitKeyguardSecurely(OnKeyguardExitResult callback);
871
872 /**
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500873 * isKeyguardLocked
874 *
875 * Return whether the keyguard is currently locked.
876 *
877 * @return true if in keyguard is locked.
878 */
879 public boolean isKeyguardLocked();
880
881 /**
882 * isKeyguardSecure
883 *
884 * Return whether the keyguard requires a password to unlock.
885 *
886 * @return true if in keyguard is secure.
887 */
888 public boolean isKeyguardSecure();
889
890 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800891 * inKeyguardRestrictedKeyInputMode
892 *
893 * if keyguard screen is showing or in restricted key input mode (i.e. in
894 * keyguard password emergency screen). When in such mode, certain keys,
895 * such as the Home key and the right soft keys, don't work.
896 *
897 * @return true if in keyguard restricted input mode.
898 */
899 public boolean inKeyguardRestrictedKeyInputMode();
900
901 /**
Dianne Hackborn90c52de2011-09-23 12:57:44 -0700902 * Ask the policy to dismiss the keyguard, if it is currently shown.
903 */
904 public void dismissKeyguardLw();
905
906 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -0700907 * Given an orientation constant, returns the appropriate surface rotation,
908 * taking into account sensors, docking mode, rotation lock, and other factors.
909 *
910 * @param orientation An orientation constant, such as
911 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
912 * @param lastRotation The most recently used rotation.
913 * @return The surface rotation to use.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800914 */
Jeff Brown01a98dd2011-09-20 15:08:29 -0700915 public int rotationForOrientationLw(int orientation, int lastRotation);
916
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -0700918 * Given an orientation constant and a rotation, returns true if the rotation
919 * has compatible metrics to the requested orientation. For example, if
920 * the application requested landscape and got seascape, then the rotation
921 * has compatible metrics; if the application requested portrait and got landscape,
922 * then the rotation has incompatible metrics; if the application did not specify
923 * a preference, then anything goes.
924 *
925 * @param orientation An orientation constant, such as
926 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
927 * @param rotation The rotation to check.
928 * @return True if the rotation is compatible with the requested orientation.
Dianne Hackborndacea8c2011-04-21 17:26:39 -0700929 */
Jeff Brown01a98dd2011-09-20 15:08:29 -0700930 public boolean rotationHasCompatibleMetricsLw(int orientation, int rotation);
Dianne Hackborndacea8c2011-04-21 17:26:39 -0700931
932 /**
Jeff Brownc0347aa2011-09-23 17:26:09 -0700933 * Called by the window manager when the rotation changes.
934 *
935 * @param rotation The new rotation.
936 */
937 public void setRotationLw(int rotation);
938
939 /**
Dianne Hackborn6af0d502009-09-28 13:25:46 -0700940 * Called when the system is mostly done booting to determine whether
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800941 * the system should go into safe mode.
942 */
943 public boolean detectSafeMode();
944
945 /**
946 * Called when the system is mostly done booting.
947 */
948 public void systemReady();
949
950 /**
Dianne Hackbornba24e4d2011-09-01 11:17:06 -0700951 * Called when the system is done booting to the point where the
952 * user can start interacting with it.
953 */
954 public void systemBooted();
955
956 /**
Dianne Hackborn661cd522011-08-22 00:26:20 -0700957 * Show boot time message to the user.
958 */
959 public void showBootMessage(final CharSequence msg, final boolean always);
960
961 /**
962 * Hide the UI for showing boot messages, never to be displayed again.
963 */
964 public void hideBootMessages();
965
966 /**
Mike Lockwoodef731622010-01-27 17:51:34 -0500967 * Called when userActivity is signalled in the power manager.
968 * This is safe to call from any thread, with any window manager locks held or not.
969 */
970 public void userActivity();
971
972 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800973 * Called when we have finished booting and can now display the home
974 * screen to the user. This wilWl happen after systemReady(), and at
975 * this point the display is active.
976 */
977 public void enableScreenAfterBoot();
978
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -0700979 public void setCurrentOrientationLw(int newOrientation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800980
981 /**
982 * Call from application to perform haptic feedback on its window.
983 */
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -0700984 public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800985
986 /**
Daniel Sandler0601eb72011-04-13 01:01:32 -0400987 * Called when we have started keeping the screen on because a window
988 * requesting this has become visible.
989 */
990 public void screenOnStartedLw();
991
992 /**
993 * Called when we have stopped keeping the screen on because the last window
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800994 * requesting this is no longer visible.
995 */
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -0700996 public void screenOnStoppedLw();
Mike Lockwood3d0ea722009-10-21 22:58:29 -0400997
998 /**
999 * Return false to disable key repeat events from being generated.
1000 */
1001 public boolean allowKeyRepeat();
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001002
1003 /**
1004 * Inform the policy that the user has chosen a preferred orientation ("rotation lock").
1005 *
1006 * @param mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or
1007 * {@link * WindowManagerPolicy#USER_ROTATION_FREE}.
1008 * @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90},
1009 * {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}.
1010 */
1011 public void setUserRotationMode(int mode, int rotation);
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001012
1013 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -07001014 * Called when a new system UI visibility is being reported, allowing
1015 * the policy to adjust what is actually reported.
1016 * @param visibility The raw visiblity reported by the status bar.
1017 * @return The new desired visibility.
1018 */
1019 public int adjustSystemUiVisibilityLw(int visibility);
1020
1021 /**
Daniel Sandler0c4ccff2011-10-19 16:39:14 -04001022 * Specifies whether there is an on-screen navigation bar separate from the status bar.
1023 */
1024 public boolean hasNavigationBar();
1025
1026 /**
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001027 * Print the WindowManagerPolicy's state into the given stream.
1028 *
1029 * @param prefix Text to print at the front of each line.
1030 * @param fd The raw file descriptor that the dump is being sent to.
1031 * @param writer The PrintWriter to which you should dump your state. This will be
1032 * closed for you after you return.
1033 * @param args additional arguments to the dump request.
1034 */
1035 public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001036}