blob: 23b0df2db1106765ddef057b4b42bc55af4c7235 [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
Tor Norbyed9273d62013-05-30 15:59:53 -070019import android.annotation.IntDef;
Bryce Lee01b0c5f2015-02-05 18:24:04 -080020import android.annotation.SystemApi;
Jorim Jaggi86905582016-02-09 21:36:09 -080021import android.app.ActivityManager.StackId;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.Context;
Tor Norbyed9273d62013-05-30 15:59:53 -070023import android.content.pm.ActivityInfo;
Dianne Hackborn2f0b1752011-05-31 17:59:49 -070024import android.content.res.CompatibilityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.res.Configuration;
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -070026import android.graphics.Point;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.graphics.Rect;
Dianne Hackbornd040edb2011-08-31 12:47:58 -070028import android.graphics.RectF;
Adam Cohenf7522022012-10-03 20:03:18 -070029import android.os.Bundle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.os.IBinder;
Dianne Hackborndf89e652011-10-06 22:35:11 -070031import android.os.Looper;
Muyuan Li94ce94e2016-02-24 16:20:54 -080032import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.view.animation.Animation;
Muyuan Li94ce94e2016-02-24 16:20:54 -080034import com.android.internal.policy.IShortcutService;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035
Dianne Hackbornf99f9c52011-01-12 15:49:25 -080036import java.io.PrintWriter;
Tor Norbyed9273d62013-05-30 15:59:53 -070037import java.lang.annotation.Retention;
38import java.lang.annotation.RetentionPolicy;
Dianne Hackbornf99f9c52011-01-12 15:49:25 -080039
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040/**
41 * This interface supplies all UI-specific behavior of the window manager. An
42 * instance of it is created by the window manager when it starts up, and allows
43 * customization of window layering, special window types, key dispatching, and
44 * layout.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -070045 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046 * <p>Because this provides deep interaction with the system window manager,
47 * specific methods on this interface can be called from a variety of contexts
48 * with various restrictions on what they can do. These are encoded through
49 * a suffixes at the end of a method encoding the thread the method is called
50 * from and any locks that are held when it is being called; if no suffix
51 * is attached to a method, then it is not called with any locks and may be
52 * called from the main window manager thread or another thread calling into
53 * the window manager.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -070054 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055 * <p>The current suffixes are:
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -070056 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 * <dl>
58 * <dt> Ti <dd> Called from the input thread. This is the thread that
59 * collects pending input events and dispatches them to the appropriate window.
60 * It may block waiting for events to be processed, so that the input stream is
61 * properly serialized.
62 * <dt> Tq <dd> Called from the low-level input queue thread. This is the
63 * thread that reads events out of the raw input devices and places them
64 * into the global input queue that is read by the <var>Ti</var> thread.
65 * This thread should not block for a long period of time on anything but the
66 * key driver.
67 * <dt> Lw <dd> Called with the main window manager lock held. Because the
68 * window manager is a very low-level system service, there are few other
69 * system services you can call with this lock held. It is explicitly okay to
70 * make calls into the package manager and power manager; it is explicitly not
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -070071 * okay to make calls into the activity manager or most other services. Note that
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 * {@link android.content.Context#checkPermission(String, int, int)} and
73 * variations require calling into the activity manager.
74 * <dt> Li <dd> Called with the input thread lock held. This lock can be
75 * acquired by the window manager while it holds the window lock, so this is
76 * even more restrictive than <var>Lw</var>.
77 * </dl>
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -070078 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079 * @hide
80 */
81public interface WindowManagerPolicy {
Jeff Brownb6997262010-10-08 22:31:17 -070082 // Policy flags. These flags are also defined in frameworks/base/include/ui/Input.h.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 public final static int FLAG_WAKE = 0x00000001;
Michael Wright337d9d22014-04-22 15:03:48 -070084 public final static int FLAG_VIRTUAL = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085
Jeff Brown85a31762010-09-01 17:01:00 -070086 public final static int FLAG_INJECTED = 0x01000000;
Jeff Browne20c9e02010-10-11 14:20:19 -070087 public final static int FLAG_TRUSTED = 0x02000000;
Jeff Brown0029c662011-03-30 02:25:18 -070088 public final static int FLAG_FILTERED = 0x04000000;
89 public final static int FLAG_DISABLE_KEY_REPEAT = 0x08000000;
Jeff Brown85a31762010-09-01 17:01:00 -070090
Jeff Brown037c33e2014-04-09 00:31:55 -070091 public final static int FLAG_INTERACTIVE = 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
Adrian Roosd5c2db62016-03-08 16:11:31 -080094 // Flags for IActivityManager.keyguardGoingAway()
95 public final static int KEYGUARD_GOING_AWAY_FLAG_TO_SHADE = 1 << 0;
96 public final static int KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS = 1 << 1;
97 public final static int KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER = 1 << 2;
98
Jeff Browndaa37532012-05-01 15:54:03 -070099 // Flags used for indicating whether the internal and/or external input devices
100 // of some type are available.
101 public final static int PRESENCE_INTERNAL = 1 << 0;
102 public final static int PRESENCE_EXTERNAL = 1 << 1;
103
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800104 public final static boolean WATCH_POINTER = false;
105
Dianne Hackbornad7fa7f2011-01-07 14:06:50 -0800106 /**
107 * Sticky broadcast of the current HDMI plugged state.
108 */
109 public final static String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED";
110
111 /**
112 * Extra in {@link #ACTION_HDMI_PLUGGED} indicating the state: true if
113 * plugged in to HDMI, false if not.
114 */
115 public final static String EXTRA_HDMI_PLUGGED_STATE = "state";
116
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 /**
Bryce Lee01b0c5f2015-02-05 18:24:04 -0800118 * Set to {@code true} when intent was invoked from pressing the home key.
119 * @hide
120 */
121 @SystemApi
122 public static final String EXTRA_FROM_HOME_KEY = "android.intent.extra.FROM_HOME_KEY";
123
124 /**
Jeff Brownd5bb82d2011-10-12 13:57:59 -0700125 * Pass this event to the user / app. To be returned from
126 * {@link #interceptKeyBeforeQueueing}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 */
128 public final static int ACTION_PASS_TO_USER = 0x00000001;
129
130 /**
Muyuan Li94ce94e2016-02-24 16:20:54 -0800131 * Register shortcuts for window manager to dispatch.
132 * Shortcut code is packed as (metaState << Integer.SIZE) | keyCode
133 * @hide
134 */
135 void registerShortcutKey(long shortcutCode, IShortcutService shortcutKeyReceiver)
136 throws RemoteException;
137
138 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 * Interface to the Window Manager state associated with a particular
140 * window. You can hold on to an instance of this interface from the call
141 * to prepareAddWindow() until removeWindow().
142 */
143 public interface WindowState {
144 /**
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800145 * Return the uid of the app that owns this window.
146 */
147 int getOwningUid();
148
149 /**
150 * Return the package name of the app that owns this window.
151 */
152 String getOwningPackage();
153
154 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 * Perform standard frame computation. The result can be obtained with
156 * getFrame() if so desired. Must be called with the window manager
157 * lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700158 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159 * @param parentFrame The frame of the parent container this window
160 * is in, used for computing its basic position.
161 * @param displayFrame The frame of the overall display in which this
162 * window can appear, used for constraining the overall dimensions
163 * of the window.
Dianne Hackbornc4aad012013-02-22 15:05:25 -0800164 * @param overlayFrame The frame within the display that is inside
165 * of the overlay region.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800166 * @param contentFrame The frame within the display in which we would
167 * like active content to appear. This will cause windows behind to
168 * be resized to match the given content frame.
169 * @param visibleFrame The frame within the display that the window
170 * is actually visible, used for computing its visible insets to be
171 * given to windows behind.
172 * This can be used as a hint for scrolling (avoiding resizing)
173 * the window to make certain that parts of its content
174 * are visible.
John Spurlock46646232013-09-30 22:32:42 -0400175 * @param decorFrame The decor frame specified by policy specific to this window,
176 * to use for proper cropping during animation.
Adrian Roosfa104232014-06-20 16:10:14 -0700177 * @param stableFrame The frame around which stable system decoration is positioned.
Filip Gruszczynski2217f612015-05-26 11:32:08 -0700178 * @param outsetFrame The frame that includes areas that aren't part of the surface but we
179 * want to treat them as such.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800180 */
181 public void computeFrameLw(Rect parentFrame, Rect displayFrame,
Adrian Roosfa104232014-06-20 16:10:14 -0700182 Rect overlayFrame, Rect contentFrame, Rect visibleFrame, Rect decorFrame,
Filip Gruszczynski2217f612015-05-26 11:32:08 -0700183 Rect stableFrame, Rect outsetFrame);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800184
185 /**
186 * Retrieve the current frame of the window that has been assigned by
187 * the window manager. Must be called with the window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700188 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800189 * @return Rect The rectangle holding the window frame.
190 */
191 public Rect getFrameLw();
192
193 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700194 * Retrieve the current position of the window that is actually shown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800195 * Must be called with the window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700196 *
197 * @return Point The point holding the shown window position.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800198 */
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700199 public Point getShownPositionLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800200
201 /**
202 * Retrieve the frame of the display that this window was last
203 * laid out in. Must be called with the
204 * window manager lock held.
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700205 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800206 * @return Rect The rectangle holding the display frame.
207 */
208 public Rect getDisplayFrameLw();
209
210 /**
Dianne Hackbornc4aad012013-02-22 15:05:25 -0800211 * Retrieve the frame of the area inside the overscan region of the
212 * display that this window was last laid out in. Must be called with the
213 * window manager lock held.
214 *
215 * @return Rect The rectangle holding the display overscan frame.
216 */
217 public Rect getOverscanFrameLw();
218
219 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800220 * Retrieve the frame of the content area that this window was last
221 * laid out in. This is the area in which the content of the window
222 * should be placed. It will be smaller than the display frame to
223 * account for screen decorations such as a status bar or soft
224 * keyboard. Must be called with the
225 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700226 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800227 * @return Rect The rectangle holding the content frame.
228 */
229 public Rect getContentFrameLw();
230
231 /**
232 * Retrieve the frame of the visible area that this window was last
233 * laid out in. This is the area of the screen in which the window
234 * will actually be fully visible. It will be smaller than the
235 * content frame to account for transient UI elements blocking it
236 * such as an input method's candidates UI. Must be called with the
237 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700238 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239 * @return Rect The rectangle holding the visible frame.
240 */
241 public Rect getVisibleFrameLw();
242
243 /**
244 * Returns true if this window is waiting to receive its given
245 * internal insets from the client app, and so should not impact the
246 * layout of other windows.
247 */
248 public boolean getGivenInsetsPendingLw();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700249
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 /**
251 * Retrieve the insets given by this window's client for the content
252 * area of windows behind it. Must be called with the
253 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700254 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 * @return Rect The left, top, right, and bottom insets, relative
256 * to the window's frame, of the actual contents.
257 */
258 public Rect getGivenContentInsetsLw();
259
260 /**
261 * Retrieve the insets given by this window's client for the visible
262 * area of windows behind it. Must be called with the
263 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700264 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800265 * @return Rect The left, top, right, and bottom insets, relative
266 * to the window's frame, of the actual visible area.
267 */
268 public Rect getGivenVisibleInsetsLw();
269
270 /**
271 * Retrieve the current LayoutParams of the window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700272 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800273 * @return WindowManager.LayoutParams The window's internal LayoutParams
274 * instance.
275 */
276 public WindowManager.LayoutParams getAttrs();
277
278 /**
Dianne Hackborn73ab6a42011-12-13 11:16:23 -0800279 * Return whether this window needs the menu key shown. Must be called
280 * with window lock held, because it may need to traverse down through
281 * window list to determine the result.
282 * @param bottom The bottom-most window to consider when determining this.
283 */
284 public boolean getNeedsMenuLw(WindowState bottom);
285
286 /**
Dianne Hackborn9a230e02011-10-06 11:51:27 -0700287 * Retrieve the current system UI visibility flags associated with
288 * this window.
289 */
290 public int getSystemUiVisibility();
291
292 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800293 * Get the layer at which this window's surface will be Z-ordered.
294 */
295 public int getSurfaceLayer();
Selim Cinekd6623612015-05-22 18:56:22 -0700296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 /**
Selim Cinekd6623612015-05-22 18:56:22 -0700298 * Retrieve the type of the top-level window.
299 *
300 * @return the base type of the parent window if attached or its own type otherwise
301 */
302 public int getBaseType();
303
304 /**
305 * Return the token for the application (actually activity) that owns
306 * this window. May return null for system windows.
307 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800308 * @return An IApplicationToken identifying the owning activity.
309 */
310 public IApplicationToken getAppToken();
311
312 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700313 * Return true if this window is participating in voice interaction.
314 */
315 public boolean isVoiceInteraction();
316
317 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700318 * Return true if, at any point, the application token associated with
319 * this window has actually displayed any windows. This is most useful
320 * with the "starting up" window to determine if any windows were
321 * displayed when it is closed.
322 *
323 * @return Returns true if one or more windows have been displayed,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800324 * else false.
325 */
326 public boolean hasAppShownWindows();
327
328 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800329 * Is this window visible? It is not visible if there is no
330 * surface, or we are in the process of running an exit animation
331 * that will remove the surface.
332 */
333 boolean isVisibleLw();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700334
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 /**
Dianne Hackborn3d163f072009-10-07 21:26:57 -0700336 * Like {@link #isVisibleLw}, but also counts a window that is currently
337 * "hidden" behind the keyguard as visible. This allows us to apply
338 * things like window flags that impact the keyguard.
339 */
340 boolean isVisibleOrBehindKeyguardLw();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700341
Dianne Hackborn3d163f072009-10-07 21:26:57 -0700342 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700343 * Is this window currently visible to the user on-screen? It is
344 * displayed either if it is visible or it is currently running an
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 * animation before no longer being visible. Must be called with the
346 * window manager lock held.
347 */
348 boolean isDisplayedLw();
349
350 /**
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700351 * Return true if this window (or a window it is attached to, but not
352 * considering its app token) is currently animating.
353 */
Filip Gruszczynski14b4e572015-11-03 15:53:55 -0800354 boolean isAnimatingLw();
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700355
356 /**
Dianne Hackborn01b02a72012-01-12 14:05:03 -0800357 * Is this window considered to be gone for purposes of layout?
358 */
359 boolean isGoneForLayoutLw();
360
361 /**
Adrian Roos76d2fe42015-07-09 14:54:08 -0700362 * Returns true if the window has a surface that it has drawn a
363 * complete UI in to. Note that this is different from {@link #hasDrawnLw()}
364 * in that it also returns true if the window is READY_TO_SHOW, but was not yet
365 * promoted to HAS_DRAWN.
366 */
367 boolean isDrawnLw();
368
369 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700370 * Returns true if this window has been shown on screen at some time in
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 * the past. Must be called with the window manager lock held.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800372 */
373 public boolean hasDrawnLw();
374
375 /**
376 * Can be called by the policy to force a window to be hidden,
377 * regardless of whether the client or window manager would like
378 * it shown. Must be called with the window manager lock held.
379 * Returns true if {@link #showLw} was last called for the window.
380 */
381 public boolean hideLw(boolean doAnimation);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700382
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800383 /**
384 * Can be called to undo the effect of {@link #hideLw}, allowing a
385 * window to be shown as long as the window manager and client would
386 * also like it to be shown. Must be called with the window manager
387 * lock held.
388 * Returns true if {@link #hideLw} was last called for the window.
389 */
390 public boolean showLw(boolean doAnimation);
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700391
392 /**
393 * Check whether the process hosting this window is currently alive.
394 */
395 public boolean isAlive();
Craig Mautner69b08182012-09-05 13:07:13 -0700396
397 /**
398 * Check if window is on {@link Display#DEFAULT_DISPLAY}.
399 * @return true if window is on default display.
400 */
401 public boolean isDefaultDisplay();
Adrian Rooscd3884d2015-02-18 17:25:23 +0100402
403 /**
404 * Check whether the window is currently dimming.
405 */
406 public boolean isDimming();
Jorim Jaggi86905582016-02-09 21:36:09 -0800407
408 /**
409 * @return the stack id this windows belongs to, or {@link StackId#INVALID_STACK_ID} if
410 * not attached to any stack.
411 */
412 int getStackId();
Wale Ogunwale9185fb02016-03-11 18:06:14 -0800413
414 /**
415 * Returns true if the window is current in multi-windowing mode. i.e. it shares the
416 * screen with other application windows.
417 */
Andrii Kulian933076d2016-03-29 17:04:42 -0700418 public boolean isInMultiWindowMode();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 }
420
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700421 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700422 * Representation of a input consumer that the policy has added to the
423 * window manager to consume input events going to windows below it.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700424 */
Selim Cinekf83e8242015-05-19 18:08:14 -0700425 public interface InputConsumer {
Dianne Hackborndf89e652011-10-06 22:35:11 -0700426 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700427 * Remove the input consumer from the window manager.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700428 */
429 void dismiss();
430 }
431
432 /**
433 * Interface for calling back in to the window manager that is private
434 * between it and the policy.
435 */
436 public interface WindowManagerFuncs {
Jeff Brownac143512012-04-05 18:57:33 -0700437 public static final int LID_ABSENT = -1;
438 public static final int LID_CLOSED = 0;
439 public static final int LID_OPEN = 1;
440
Michael Wright3818c922014-09-02 13:59:07 -0700441 public static final int CAMERA_LENS_COVER_ABSENT = -1;
442 public static final int CAMERA_LENS_UNCOVERED = 0;
443 public static final int CAMERA_LENS_COVERED = 1;
444
Dianne Hackborndf89e652011-10-06 22:35:11 -0700445 /**
446 * Ask the window manager to re-evaluate the system UI flags.
447 */
448 public void reevaluateStatusBarVisibility();
449
450 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700451 * Add a input consumer which will consume all input events going to any window below it.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700452 */
Selim Cinekf83e8242015-05-19 18:08:14 -0700453 public InputConsumer addInputConsumer(Looper looper,
454 InputEventReceiver.Factory inputEventReceiverFactory);
Jeff Brownac143512012-04-05 18:57:33 -0700455
456 /**
457 * Returns a code that describes the current state of the lid switch.
458 */
459 public int getLidState();
460
461 /**
Edward Savage-Jones7def60d2015-11-13 13:27:03 +0100462 * Lock the device now.
463 */
464 public void lockDeviceNow();
465
466 /**
Michael Wright3818c922014-09-02 13:59:07 -0700467 * Returns a code that descripbes whether the camera lens is covered or not.
468 */
469 public int getCameraLensCoverState();
470
471 /**
Yohei Yukawaae61f712015-12-09 13:00:10 -0800472 * Switch the input method, to be precise, input method subtype.
473 *
474 * @param forwardDirection {@code true} to rotate in a forward direction.
475 */
476 public void switchInputMethod(boolean forwardDirection);
477
Jeff Brown9a538ee2012-08-20 14:56:57 -0700478 public void shutdown(boolean confirm);
479 public void rebootSafeMode(boolean confirm);
John Spurlock04db1762013-05-13 12:46:41 -0400480
481 /**
482 * Return the window manager lock needed to correctly call "Lw" methods.
483 */
484 public Object getWindowManagerLock();
Craig Mautner037aa8d2013-06-07 10:35:44 -0700485
486 /** Register a system listener for touch events */
487 void registerPointerEventListener(PointerEventListener listener);
488
489 /** Unregister a system listener for touch events */
490 void unregisterPointerEventListener(PointerEventListener listener);
Jorim Jaggi81ba11e2016-02-03 22:04:22 -0800491
492 /**
493 * @return The content insets of the docked divider window.
494 */
495 int getDockedDividerInsetsLw();
Jorim Jaggi86905582016-02-09 21:36:09 -0800496
497 /**
498 * Retrieves the {@param outBounds} from the stack with id {@param stackId}.
499 */
500 void getStackBounds(int stackId, Rect outBounds);
Craig Mautner037aa8d2013-06-07 10:35:44 -0700501 }
502
503 public interface PointerEventListener {
504 /**
505 * 1. onPointerEvent will be called on the service.UiThread.
506 * 2. motionEvent will be recycled after onPointerEvent returns so if it is needed later a
507 * copy() must be made and the copy must be recycled.
508 **/
509 public void onPointerEvent(MotionEvent motionEvent);
Dianne Hackborndf89e652011-10-06 22:35:11 -0700510 }
511
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800512 /** Window has been added to the screen. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800513 public static final int TRANSIT_ENTER = 1;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800514 /** Window has been removed from the screen. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800515 public static final int TRANSIT_EXIT = 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800516 /** Window has been made visible. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800517 public static final int TRANSIT_SHOW = 3;
518 /** Window has been made invisible.
519 * TODO: Consider removal as this is unused. */
520 public static final int TRANSIT_HIDE = 4;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800521 /** The "application starting" preview window is no longer needed, and will
522 * animate away to show the real window. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800523 public static final int TRANSIT_PREVIEW_DONE = 5;
524
Dianne Hackborn254cb442010-01-27 19:23:59 -0800525 // NOTE: screen off reasons are in order of significance, with more
526 // important ones lower than less important ones.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700527
Dianne Hackborn254cb442010-01-27 19:23:59 -0800528 /** Screen turned off because of a device admin */
529 public final int OFF_BECAUSE_OF_ADMIN = 1;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800530 /** Screen turned off because of power button */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800531 public final int OFF_BECAUSE_OF_USER = 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532 /** Screen turned off because of timeout */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800533 public final int OFF_BECAUSE_OF_TIMEOUT = 3;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534
Tor Norbyed9273d62013-05-30 15:59:53 -0700535 /** @hide */
536 @IntDef({USER_ROTATION_FREE, USER_ROTATION_LOCKED})
537 @Retention(RetentionPolicy.SOURCE)
538 public @interface UserRotationMode {}
539
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400540 /** When not otherwise specified by the activity's screenOrientation, rotation should be
541 * determined by the system (that is, using sensors). */
542 public final int USER_ROTATION_FREE = 0;
543 /** When not otherwise specified by the activity's screenOrientation, rotation is set by
544 * the user. */
545 public final int USER_ROTATION_LOCKED = 1;
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700546
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800547 /**
548 * Perform initialization of the policy.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700549 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800550 * @param context The system context we are running in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 */
552 public void init(Context context, IWindowManager windowManager,
Jeff Brown96307042012-07-27 15:51:34 -0700553 WindowManagerFuncs windowManagerFuncs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554
555 /**
Craig Mautner46ac6fa2013-08-01 10:06:34 -0700556 * @return true if com.android.internal.R.bool#config_forceDefaultOrientation is true.
557 */
558 public boolean isDefaultOrientationForced();
559
560 /**
Dianne Hackborn9d132642011-04-21 17:26:39 -0700561 * Called by window manager once it has the initial, default native
562 * display dimensions.
563 */
Dianne Hackborndde331c2012-08-03 14:01:57 -0700564 public void setInitialDisplaySize(Display display, int width, int height, int density);
Dianne Hackborndacea8c2011-04-21 17:26:39 -0700565
Dianne Hackborn9d132642011-04-21 17:26:39 -0700566 /**
Dianne Hackbornc652de82013-02-15 16:32:56 -0800567 * Called by window manager to set the overscan region that should be used for the
568 * given display.
569 */
570 public void setDisplayOverscan(Display display, int left, int top, int right, int bottom);
571
572 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800573 * Check permissions when adding a window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700574 *
Dianne Hackbornc2293022013-02-06 23:14:49 -0800575 * @param attrs The window's LayoutParams.
576 * @param outAppOp First element will be filled with the app op corresponding to
577 * this window, or OP_NONE.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700578 *
Jeff Brown98365d72012-08-19 20:30:52 -0700579 * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800580 * else an error code, usually
Jeff Brown98365d72012-08-19 20:30:52 -0700581 * {@link WindowManagerGlobal#ADD_PERMISSION_DENIED}, to abort the add.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800582 */
Dianne Hackbornc2293022013-02-06 23:14:49 -0800583 public int checkAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800584
585 /**
Craig Mautner88400d32012-09-30 12:35:45 -0700586 * Check permissions when adding a window.
587 *
588 * @param attrs The window's LayoutParams.
589 *
590 * @return True if the window may only be shown to the current user, false if the window can
591 * be shown on all users' windows.
592 */
593 public boolean checkShowToOwnerOnly(WindowManager.LayoutParams attrs);
594
595 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800596 * Sanitize the layout parameters coming from a client. Allows the policy
597 * to do things like ensure that windows of a specific type can't take
598 * input focus.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700599 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800600 * @param attrs The window layout parameters to be modified. These values
601 * are modified in-place.
602 */
603 public void adjustWindowParamsLw(WindowManager.LayoutParams attrs);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700604
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800605 /**
606 * After the window manager has computed the current configuration based
607 * on its knowledge of the display and input devices, it gives the policy
608 * a chance to adjust the information contained in it. If you want to
609 * leave it as-is, simply do nothing.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700610 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800611 * <p>This method may be called by any thread in the window manager, but
612 * no internal locks in the window manager will be held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700613 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800614 * @param config The Configuration being computed, for you to change as
615 * desired.
Jeff Browndaa37532012-05-01 15:54:03 -0700616 * @param keyboardPresence Flags that indicate whether internal or external
617 * keyboards are present.
618 * @param navigationPresence Flags that indicate whether internal or external
619 * navigation devices are present.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800620 */
Jeff Browndaa37532012-05-01 15:54:03 -0700621 public void adjustConfigurationLw(Configuration config, int keyboardPresence,
622 int navigationPresence);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700623
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800624 /**
625 * Assign a window type to a layer. Allows you to control how different
626 * kinds of windows are ordered on-screen.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700627 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800628 * @param type The type of window being assigned.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700629 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800630 * @return int An arbitrary integer used to order windows, with lower
631 * numbers below higher ones.
632 */
633 public int windowTypeToLayerLw(int type);
634
635 /**
636 * Return how to Z-order sub-windows in relation to the window they are
637 * attached to. Return positive to have them ordered in front, negative for
638 * behind.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700639 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 * @param type The sub-window type code.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700641 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 * @return int Layer in relation to the attached window, where positive is
643 * above and negative is below.
644 */
645 public int subWindowTypeToLayerLw(int type);
646
647 /**
Dianne Hackborn6136b7e2009-09-18 01:53:49 -0700648 * Get the highest layer (actually one more than) that the wallpaper is
649 * allowed to be in.
650 */
651 public int getMaxWallpaperLayer();
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700652
653 /**
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700654 * Return the display width available after excluding any screen
Jorim Jaggi82c9dc92016-02-05 15:10:33 -0800655 * decorations that could never be removed in Honeycomb. That is, system bar or
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700656 * button bar.
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400657 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800658 public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation,
659 int uiMode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400660
661 /**
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700662 * Return the display height available after excluding any screen
Jorim Jaggi82c9dc92016-02-05 15:10:33 -0800663 * decorations that could never be removed in Honeycomb. That is, system bar or
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700664 * button bar.
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400665 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800666 public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation,
667 int uiMode);
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700668
669 /**
670 * Return the available screen width that we should report for the
671 * configuration. This must be no larger than
Craig Mautner61ac6bb2012-02-02 17:29:33 -0800672 * {@link #getNonDecorDisplayWidth(int, int, int)}; it may be smaller than
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700673 * that to account for more transient decoration like a status bar.
674 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800675 public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation,
676 int uiMode);
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700677
678 /**
679 * Return the available screen height that we should report for the
680 * configuration. This must be no larger than
Craig Mautner61ac6bb2012-02-02 17:29:33 -0800681 * {@link #getNonDecorDisplayHeight(int, int, int)}; it may be smaller than
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700682 * that to account for more transient decoration like a status bar.
683 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800684 public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation,
685 int uiMode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400686
687 /**
Craig Mautnerc9457fa2014-06-06 14:27:48 -0700688 * Return whether the given window is forcibly hiding all windows except windows with
689 * FLAG_SHOW_WHEN_LOCKED set. Typically returns true for the keyguard.
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700690 */
Craig Mautnerc9457fa2014-06-06 14:27:48 -0700691 public boolean isForceHiding(WindowManager.LayoutParams attrs);
Jorim Jaggi0d674622014-05-21 01:34:15 +0200692
693
694 /**
Craig Mautnerc9457fa2014-06-06 14:27:48 -0700695 * Return whether the given window can become one that passes isForceHiding() test.
Jorim Jaggi0d674622014-05-21 01:34:15 +0200696 * Typically returns true for the StatusBar.
697 */
698 public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs);
699
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700700 /**
701 * Determine if a window that is behind one that is force hiding
Craig Mautnerc9457fa2014-06-06 14:27:48 -0700702 * (as determined by {@link #isForceHiding}) should actually be hidden.
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700703 * For example, typically returns false for the status bar. Be careful
704 * to return false for any window that you may hide yourself, since this
705 * will conflict with what you set.
706 */
707 public boolean canBeForceHidden(WindowState win, WindowManager.LayoutParams attrs);
Jorim Jaggi0d674622014-05-21 01:34:15 +0200708
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700709 /**
Craig Mautner7d7808f2014-09-11 18:02:38 -0700710 * Return the window that is hiding the keyguard, if such a thing exists.
711 */
712 public WindowState getWinShowWhenLockedLw();
713
714 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800715 * Called when the system would like to show a UI to indicate that an
716 * application is starting. You can use this to add a
717 * APPLICATION_STARTING_TYPE window with the given appToken to the window
718 * manager (using the normal window manager APIs) that will be shown until
719 * the application displays its own window. This is called without the
720 * window manager locked so that you can call back into it.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700721 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800722 * @param appToken Token of the application being started.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700723 * @param packageName The name of the application package being started.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800724 * @param theme Resource defining the application's overall visual theme.
725 * @param nonLocalizedLabel The default title label of the application if
726 * no data is found in the resource.
727 * @param labelRes The resource ID the application would like to use as its name.
728 * @param icon The resource ID the application would like to use as its icon.
Dianne Hackborn7eec10e2010-11-12 18:03:47 -0800729 * @param windowFlags Window layout flags.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700730 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800731 * @return Optionally you can return the View that was used to create the
732 * window, for easy removal in removeStartingWindow.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700733 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800734 * @see #removeStartingWindow
735 */
736 public View addStartingWindow(IBinder appToken, String packageName,
Dianne Hackborn2f0b1752011-05-31 17:59:49 -0700737 int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel,
Adam Powell04fe6eb2013-05-31 14:39:48 -0700738 int labelRes, int icon, int logo, int windowFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800739
740 /**
741 * Called when the first window of an application has been displayed, while
742 * {@link #addStartingWindow} has created a temporary initial window for
743 * that application. You should at this point remove the window from the
744 * window manager. This is called without the window manager locked so
745 * that you can call back into it.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700746 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800747 * <p>Note: due to the nature of these functions not being called with the
748 * window manager locked, you must be prepared for this function to be
749 * called multiple times and/or an initial time with a null View window
750 * even if you previously returned one.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700751 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800752 * @param appToken Token of the application that has started.
753 * @param window Window View that was returned by createStartingWindow.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700754 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800755 * @see #addStartingWindow
756 */
757 public void removeStartingWindow(IBinder appToken, View window);
758
759 /**
760 * Prepare for a window being added to the window manager. You can throw an
761 * exception here to prevent the window being added, or do whatever setup
762 * you need to keep track of the window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700763 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 * @param win The window being added.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700765 * @param attrs The window's LayoutParams.
766 *
Jeff Brown98365d72012-08-19 20:30:52 -0700767 * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed, else an
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800768 * error code to abort the add.
769 */
770 public int prepareAddWindowLw(WindowState win,
771 WindowManager.LayoutParams attrs);
772
773 /**
774 * Called when a window is being removed from a window manager. Must not
775 * throw an exception -- clean up as much as possible.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700776 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800777 * @param win The window being removed.
778 */
779 public void removeWindowLw(WindowState win);
780
781 /**
782 * Control the animation to run when a window's state changes. Return a
783 * non-0 number to force the animation to a specific resource ID, or 0
784 * to use the default animation.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700785 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800786 * @param win The window that is changing.
787 * @param transit What is happening to the window: {@link #TRANSIT_ENTER},
788 * {@link #TRANSIT_EXIT}, {@link #TRANSIT_SHOW}, or
789 * {@link #TRANSIT_HIDE}.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700790 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800791 * @return Resource ID of the actual animation to use, or 0 for none.
792 */
793 public int selectAnimationLw(WindowState win, int transit);
794
795 /**
Craig Mautner3c174372013-02-21 17:54:37 -0800796 * Determine the animation to run for a rotation transition based on the
797 * top fullscreen windows {@link WindowManager.LayoutParams#rotationAnimation}
798 * and whether it is currently fullscreen and frontmost.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700799 *
800 * @param anim The exiting animation resource id is stored in anim[0], the
Craig Mautner3c174372013-02-21 17:54:37 -0800801 * entering animation resource id is stored in anim[1].
802 */
803 public void selectRotationAnimationLw(int anim[]);
804
805 /**
806 * Validate whether the current top fullscreen has specified the same
807 * {@link WindowManager.LayoutParams#rotationAnimation} value as that
808 * being passed in from the previous top fullscreen window.
809 *
810 * @param exitAnimId exiting resource id from the previous window.
811 * @param enterAnimId entering resource id from the previous window.
812 * @param forceDefault For rotation animations only, if true ignore the
813 * animation values and just return false.
814 * @return true if the previous values are still valid, false if they
815 * should be replaced with the default.
816 */
817 public boolean validateRotationAnimationLw(int exitAnimId, int enterAnimId,
818 boolean forceDefault);
819
820 /**
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700821 * Create and return an animation to re-display a force hidden window.
822 */
Jorim Jaggi84a3e7a2014-08-13 17:58:58 +0200823 public Animation createForceHideEnterAnimation(boolean onWallpaper,
824 boolean goingToNotificationShade);
Jorim Jaggi76a16232014-08-08 17:00:47 +0200825
826 /**
827 * Create and return an animation to let the wallpaper disappear after being shown on a force
828 * hiding window.
829 */
Jorim Jaggi84a3e7a2014-08-13 17:58:58 +0200830 public Animation createForceHideWallpaperExitAnimation(boolean goingToNotificationShade);
Jorim Jaggi76a16232014-08-08 17:00:47 +0200831
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700832 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -0700833 * Called from the input reader thread before a key is enqueued.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800834 *
835 * <p>There are some actions that need to be handled here because they
836 * affect the power state of the device, for example, the power keys.
837 * Generally, it's best to keep as little as possible in the queue thread
838 * because it's the most fragile.
Jeff Brown1f245102010-11-18 20:53:46 -0800839 * @param event The key event.
Jeff Brown00fa7bd2010-07-02 15:37:36 -0700840 * @param policyFlags The policy flags associated with the key.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800841 *
Jeff Brown26875502014-01-30 21:47:47 -0800842 * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800843 */
Jeff Brown037c33e2014-04-09 00:31:55 -0700844 public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags);
Jeff Brown56194eb2011-03-02 19:23:13 -0800845
846 /**
Michael Wright70af00a2014-09-03 19:30:20 -0700847 * Called from the input reader thread before a motion is enqueued when the device is in a
848 * non-interactive state.
Jeff Brown56194eb2011-03-02 19:23:13 -0800849 *
850 * <p>There are some actions that need to be handled here because they
851 * affect the power state of the device, for example, waking on motions.
852 * Generally, it's best to keep as little as possible in the queue thread
853 * because it's the most fragile.
854 * @param policyFlags The policy flags associated with the motion.
855 *
Jeff Brown26875502014-01-30 21:47:47 -0800856 * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
Jeff Brown56194eb2011-03-02 19:23:13 -0800857 */
Michael Wright70af00a2014-09-03 19:30:20 -0700858 public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags);
Jeff Brown56194eb2011-03-02 19:23:13 -0800859
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800860 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -0700861 * Called from the input dispatcher thread before a key is dispatched to a window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800862 *
863 * <p>Allows you to define
Jeff Brown3915bb82010-11-05 15:02:16 -0700864 * behavior for keys that can not be overridden by applications.
865 * This method is called from the input thread, with no locks held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700866 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800867 * @param win The window that currently has focus. This is where the key
868 * event will normally go.
Jeff Brown1f245102010-11-18 20:53:46 -0800869 * @param event The key event.
Jeff Brown00fa7bd2010-07-02 15:37:36 -0700870 * @param policyFlags The policy flags associated with the key.
Jeff Brownd5bb82d2011-10-12 13:57:59 -0700871 * @return 0 if the key should be dispatched immediately, -1 if the key should
872 * not be dispatched ever, or a positive value indicating the number of
873 * milliseconds by which the key dispatch should be delayed before trying
874 * again.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800875 */
Jeff Brownd5bb82d2011-10-12 13:57:59 -0700876 public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800877
878 /**
Jeff Brown3915bb82010-11-05 15:02:16 -0700879 * Called from the input dispatcher thread when an application did not handle
880 * a key that was dispatched to it.
881 *
882 * <p>Allows you to define default global behavior for keys that were not handled
883 * by applications. This method is called from the input thread, with no locks held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700884 *
Jeff Brown3915bb82010-11-05 15:02:16 -0700885 * @param win The window that currently has focus. This is where the key
886 * event will normally go.
Jeff Brown1f245102010-11-18 20:53:46 -0800887 * @param event The key event.
Jeff Brown3915bb82010-11-05 15:02:16 -0700888 * @param policyFlags The policy flags associated with the key.
Jeff Brown49ed71d2010-12-06 17:13:33 -0800889 * @return Returns an alternate key event to redispatch as a fallback, or null to give up.
890 * The caller is responsible for recycling the key event.
Jeff Brown3915bb82010-11-05 15:02:16 -0700891 */
Jeff Brown49ed71d2010-12-06 17:13:33 -0800892 public KeyEvent dispatchUnhandledKey(WindowState win, KeyEvent event, int policyFlags);
Jeff Brown3915bb82010-11-05 15:02:16 -0700893
894 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800895 * Called when layout of the windows is about to start.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700896 *
Craig Mautner69b08182012-09-05 13:07:13 -0700897 * @param isDefaultDisplay true if window is on {@link Display#DEFAULT_DISPLAY}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800898 * @param displayWidth The current full width of the screen.
899 * @param displayHeight The current full height of the screen.
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800900 * @param displayRotation The current rotation being applied to the base window.
901 * @param uiMode The current uiMode in configuration.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800902 */
Craig Mautner69b08182012-09-05 13:07:13 -0700903 public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight,
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800904 int displayRotation, int uiMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905
906 /**
John Spurlock46646232013-09-30 22:32:42 -0400907 * Returns the bottom-most layer of the system decor, above which no policy decor should
908 * be applied.
Dianne Hackborn85afd1b2012-05-13 13:31:06 -0700909 */
John Spurlock46646232013-09-30 22:32:42 -0400910 public int getSystemDecorLayerLw();
Dianne Hackborn85afd1b2012-05-13 13:31:06 -0700911
912 /**
Craig Mautner967212c2013-04-13 21:10:58 -0700913 * Return the rectangle of the screen that is available for applications to run in.
914 * This will be called immediately after {@link #beginLayoutLw}.
915 *
916 * @param r The rectangle to be filled with the boundaries available to applications.
917 */
918 public void getContentRectLw(Rect r);
919
920 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800921 * Called for each window attached to the window manager as layout is
922 * proceeding. The implementation of this function must take care of
923 * setting the window's frame, either here or in finishLayout().
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700924 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800925 * @param win The window being positioned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 * @param attached For sub-windows, the window it is attached to; this
927 * window will already have had layoutWindow() called on it
928 * so you can use its Rect. Otherwise null.
929 */
Craig Mautnerc9457fa2014-06-06 14:27:48 -0700930 public void layoutWindowLw(WindowState win, WindowState attached);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700932
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800933 /**
934 * Return the insets for the areas covered by system windows. These values
935 * are computed on the most recent layout, so they are not guaranteed to
936 * be correct.
Adrian Roos37d7a682014-11-06 18:15:16 +0100937 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800938 * @param attrs The LayoutParams of the window.
Filip Gruszczynski0ec13282015-06-25 11:26:01 -0700939 * @param rotation Rotation of the display.
Adrian Roos37d7a682014-11-06 18:15:16 +0100940 * @param outContentInsets The areas covered by system windows, expressed as positive insets.
941 * @param outStableInsets The areas covered by stable system windows irrespective of their
942 * current visibility. Expressed as positive insets.
Filip Gruszczynski0ec13282015-06-25 11:26:01 -0700943 * @param outOutsets The areas that are not real display, but we would like to treat as such.
Jorim Jaggi0ffd49c2016-02-12 15:04:21 -0800944 * @return Whether to always consume the navigation bar.
945 * See {@link #isNavBarForcedShownLw(WindowState)}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800946 */
Jorim Jaggi0ffd49c2016-02-12 15:04:21 -0800947 public boolean getInsetHintLw(WindowManager.LayoutParams attrs, int rotation,
Filip Gruszczynski0ec13282015-06-25 11:26:01 -0700948 Rect outContentInsets, Rect outStableInsets, Rect outOutsets);
Dianne Hackborn85afd1b2012-05-13 13:31:06 -0700949
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 /**
951 * Called when layout of the windows is finished. After this function has
952 * returned, all windows given to layoutWindow() <em>must</em> have had a
953 * frame assigned.
954 */
Craig Mautner61ac6bb2012-02-02 17:29:33 -0800955 public void finishLayoutLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800956
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700957 /** Layout state may have changed (so another layout will be performed) */
958 static final int FINISH_LAYOUT_REDO_LAYOUT = 0x0001;
959 /** Configuration state may have changed */
960 static final int FINISH_LAYOUT_REDO_CONFIG = 0x0002;
961 /** Wallpaper may need to move */
962 static final int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004;
Dianne Hackbornb8b11a02010-03-10 15:53:11 -0800963 /** Need to recompute animations */
964 static final int FINISH_LAYOUT_REDO_ANIM = 0x0008;
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700965
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800966 /**
Craig Mautner39834192012-09-02 07:47:24 -0700967 * Called following layout of all windows before each window has policy applied.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700968 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800969 * @param displayWidth The current full width of the screen.
970 * @param displayHeight The current full height of the screen.
971 */
Craig Mautner39834192012-09-02 07:47:24 -0700972 public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800973
974 /**
Craig Mautner39834192012-09-02 07:47:24 -0700975 * Called following layout of all window to apply policy to each window.
Yohei Yukawad1a09222015-06-30 16:22:05 -0700976 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800977 * @param win The window being positioned.
Yohei Yukawad1a09222015-06-30 16:22:05 -0700978 * @param attrs The LayoutParams of the window.
979 * @param attached For sub-windows, the window it is attached to. Otherwise null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800980 */
Craig Mautner39834192012-09-02 07:47:24 -0700981 public void applyPostLayoutPolicyLw(WindowState win,
Yohei Yukawad1a09222015-06-30 16:22:05 -0700982 WindowManager.LayoutParams attrs, WindowState attached);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800983
984 /**
Craig Mautner39834192012-09-02 07:47:24 -0700985 * Called following layout of all windows and after policy has been applied
986 * to each window. If in this function you do
987 * something that may have modified the animation state of another window,
988 * be sure to return non-zero in order to perform another pass through layout.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700989 *
Dianne Hackbornb8b11a02010-03-10 15:53:11 -0800990 * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT},
991 * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER},
992 * or {@link #FINISH_LAYOUT_REDO_ANIM}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800993 */
Craig Mautner39834192012-09-02 07:47:24 -0700994 public int finishPostLayoutPolicyLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800995
996 /**
Dianne Hackbornde2606d2009-12-18 16:53:55 -0800997 * Return true if it is okay to perform animations for an app transition
998 * that is about to occur. You may return false for this if, for example,
999 * the lock screen is currently displayed so the switch should happen
1000 * immediately.
1001 */
1002 public boolean allowAppAnimationsLw();
Joe Onorato664644d2011-01-23 17:53:23 -08001003
1004
1005 /**
1006 * A new window has been focused.
1007 */
Dianne Hackborndf89e652011-10-06 22:35:11 -07001008 public int focusChangedLw(WindowState lastFocus, WindowState newFocus);
Jeff Brown36c4db82014-09-19 12:05:31 -07001009
1010 /**
Jeff Brown416c49c2015-05-26 19:50:18 -07001011 * Called when the device has started waking up.
Jeff Brown36c4db82014-09-19 12:05:31 -07001012 */
Jeff Brown416c49c2015-05-26 19:50:18 -07001013 public void startedWakingUp();
Jeff Brown36c4db82014-09-19 12:05:31 -07001014
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001015 /**
Jeff Brown416c49c2015-05-26 19:50:18 -07001016 * Called when the device has finished waking up.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001017 */
Jeff Brown416c49c2015-05-26 19:50:18 -07001018 public void finishedWakingUp();
1019
1020 /**
1021 * Called when the device has started going to sleep.
1022 *
1023 * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN},
1024 * or {@link #OFF_BECAUSE_OF_TIMEOUT}.
1025 */
1026 public void startedGoingToSleep(int why);
1027
1028 /**
1029 * Called when the device has finished going to sleep.
1030 *
1031 * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN},
1032 * or {@link #OFF_BECAUSE_OF_TIMEOUT}.
1033 */
1034 public void finishedGoingToSleep(int why);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001035
Jeff Brown36c4db82014-09-19 12:05:31 -07001036 /**
1037 * Called when the device is about to turn on the screen to show content.
1038 * When waking up, this method will be called once after the call to wakingUp().
1039 * When dozing, the method will be called sometime after the call to goingToSleep() and
1040 * may be called repeatedly in the case where the screen is pulsing on and off.
1041 *
1042 * Must call back on the listener to tell it when the higher-level system
1043 * is ready for the screen to go on (i.e. the lock screen is shown).
1044 */
1045 public void screenTurningOn(ScreenOnListener screenOnListener);
1046
Jeff Brown3ee549c2014-09-22 20:14:39 -07001047 /**
Jorim Jaggi0d210f62015-07-10 14:24:44 -07001048 * Called when the device has actually turned on the screen, i.e. the display power state has
1049 * been set to ON and the screen is unblocked.
1050 */
1051 public void screenTurnedOn();
1052
1053 /**
Jeff Brown3ee549c2014-09-22 20:14:39 -07001054 * Called when the device has turned the screen off.
1055 */
1056 public void screenTurnedOff();
1057
Dianne Hackborn38e29a62011-09-18 14:43:08 -07001058 public interface ScreenOnListener {
1059 void onScreenOn();
Craig Mautner61ac6bb2012-02-02 17:29:33 -08001060 }
Dianne Hackborn38e29a62011-09-18 14:43:08 -07001061
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001062 /**
Jeff Brown3ee549c2014-09-22 20:14:39 -07001063 * Return whether the default display is on and not blocked by a black surface.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001064 */
Jeff Brown3ee549c2014-09-22 20:14:39 -07001065 public boolean isScreenOn();
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001066
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001067 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001068 * Tell the policy that the lid switch has changed state.
1069 * @param whenNanos The time when the change occurred in uptime nanoseconds.
1070 * @param lidOpen True if the lid is now open.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001071 */
Jeff Brown46b9ac02010-04-22 18:58:52 -07001072 public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen);
Michael Wright3818c922014-09-02 13:59:07 -07001073
1074 /**
1075 * Tell the policy that the camera lens has been covered or uncovered.
1076 * @param whenNanos The time when the change occurred in uptime nanoseconds.
1077 * @param lensCovered True if the lens is covered.
1078 */
1079 public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered);
1080
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001082 * Tell the policy if anyone is requesting that keyguard not come on.
1083 *
1084 * @param enabled Whether keyguard can be on or not. does not actually
1085 * turn it on, unless it was previously disabled with this function.
1086 *
1087 * @see android.app.KeyguardManager.KeyguardLock#disableKeyguard()
1088 * @see android.app.KeyguardManager.KeyguardLock#reenableKeyguard()
1089 */
Craig Mautner3c174372013-02-21 17:54:37 -08001090 @SuppressWarnings("javadoc")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001091 public void enableKeyguard(boolean enabled);
1092
1093 /**
1094 * Callback used by {@link WindowManagerPolicy#exitKeyguardSecurely}
1095 */
1096 interface OnKeyguardExitResult {
1097 void onKeyguardExitResult(boolean success);
1098 }
1099
1100 /**
1101 * Tell the policy if anyone is requesting the keyguard to exit securely
1102 * (this would be called after the keyguard was disabled)
1103 * @param callback Callback to send the result back.
1104 * @see android.app.KeyguardManager#exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult)
1105 */
Craig Mautner3c174372013-02-21 17:54:37 -08001106 @SuppressWarnings("javadoc")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001107 void exitKeyguardSecurely(OnKeyguardExitResult callback);
1108
1109 /**
Mike Lockwood520d8bc2011-02-18 13:23:13 -05001110 * isKeyguardLocked
1111 *
1112 * Return whether the keyguard is currently locked.
1113 *
1114 * @return true if in keyguard is locked.
1115 */
1116 public boolean isKeyguardLocked();
1117
1118 /**
1119 * isKeyguardSecure
1120 *
1121 * Return whether the keyguard requires a password to unlock.
1122 *
1123 * @return true if in keyguard is secure.
1124 */
1125 public boolean isKeyguardSecure();
1126
1127 /**
Adrian Roos461829d2015-06-03 14:41:18 -07001128 * Return whether the keyguard is on.
1129 *
1130 * @return true if in keyguard is on.
1131 */
1132 public boolean isKeyguardShowingOrOccluded();
1133
1134 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001135 * inKeyguardRestrictedKeyInputMode
1136 *
1137 * if keyguard screen is showing or in restricted key input mode (i.e. in
1138 * keyguard password emergency screen). When in such mode, certain keys,
1139 * such as the Home key and the right soft keys, don't work.
1140 *
1141 * @return true if in keyguard restricted input mode.
1142 */
1143 public boolean inKeyguardRestrictedKeyInputMode();
1144
1145 /**
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001146 * Ask the policy to dismiss the keyguard, if it is currently shown.
1147 */
1148 public void dismissKeyguardLw();
1149
1150 /**
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02001151 * Notifies the keyguard that the activity has drawn it was waiting for.
1152 */
1153 public void notifyActivityDrawnForKeyguardLw();
1154
1155 /**
Jorim Jaggicff0acb2014-03-31 16:35:15 +02001156 * Ask the policy whether the Keyguard has drawn. If the Keyguard is disabled, this method
1157 * returns true as soon as we know that Keyguard is disabled.
1158 *
1159 * @return true if the keyguard has drawn.
1160 */
1161 public boolean isKeyguardDrawnLw();
1162
1163 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -07001164 * Given an orientation constant, returns the appropriate surface rotation,
1165 * taking into account sensors, docking mode, rotation lock, and other factors.
1166 *
1167 * @param orientation An orientation constant, such as
1168 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
1169 * @param lastRotation The most recently used rotation.
1170 * @return The surface rotation to use.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001171 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001172 public int rotationForOrientationLw(@ActivityInfo.ScreenOrientation int orientation,
1173 int lastRotation);
Jeff Brown01a98dd2011-09-20 15:08:29 -07001174
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001175 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -07001176 * Given an orientation constant and a rotation, returns true if the rotation
1177 * has compatible metrics to the requested orientation. For example, if
1178 * the application requested landscape and got seascape, then the rotation
1179 * has compatible metrics; if the application requested portrait and got landscape,
1180 * then the rotation has incompatible metrics; if the application did not specify
1181 * a preference, then anything goes.
1182 *
1183 * @param orientation An orientation constant, such as
1184 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
1185 * @param rotation The rotation to check.
1186 * @return True if the rotation is compatible with the requested orientation.
Dianne Hackborndacea8c2011-04-21 17:26:39 -07001187 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001188 public boolean rotationHasCompatibleMetricsLw(@ActivityInfo.ScreenOrientation int orientation,
1189 int rotation);
Dianne Hackborndacea8c2011-04-21 17:26:39 -07001190
1191 /**
Jeff Brownc0347aa2011-09-23 17:26:09 -07001192 * Called by the window manager when the rotation changes.
1193 *
1194 * @param rotation The new rotation.
1195 */
1196 public void setRotationLw(int rotation);
1197
1198 /**
Jeff Brownac143512012-04-05 18:57:33 -07001199 * Called when the system is mostly done booting to set whether
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001200 * the system should go into safe mode.
1201 */
Jeff Brownac143512012-04-05 18:57:33 -07001202 public void setSafeMode(boolean safeMode);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001203
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204 /**
1205 * Called when the system is mostly done booting.
1206 */
1207 public void systemReady();
1208
1209 /**
Dianne Hackbornba24e4d2011-09-01 11:17:06 -07001210 * Called when the system is done booting to the point where the
1211 * user can start interacting with it.
1212 */
1213 public void systemBooted();
1214
1215 /**
Dianne Hackborn661cd522011-08-22 00:26:20 -07001216 * Show boot time message to the user.
1217 */
1218 public void showBootMessage(final CharSequence msg, final boolean always);
1219
1220 /**
1221 * Hide the UI for showing boot messages, never to be displayed again.
1222 */
1223 public void hideBootMessages();
1224
1225 /**
Mike Lockwoodef731622010-01-27 17:51:34 -05001226 * Called when userActivity is signalled in the power manager.
1227 * This is safe to call from any thread, with any window manager locks held or not.
1228 */
1229 public void userActivity();
1230
1231 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001232 * Called when we have finished booting and can now display the home
Jeff Brownc042ee22012-05-08 13:03:42 -07001233 * screen to the user. This will happen after systemReady(), and at
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 * this point the display is active.
1235 */
1236 public void enableScreenAfterBoot();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001237
Tor Norbyed9273d62013-05-30 15:59:53 -07001238 public void setCurrentOrientationLw(@ActivityInfo.ScreenOrientation int newOrientation);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001239
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 /**
1241 * Call from application to perform haptic feedback on its window.
1242 */
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -07001243 public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001245 /**
Daniel Sandler0601eb72011-04-13 01:01:32 -04001246 * Called when we have started keeping the screen on because a window
1247 * requesting this has become visible.
1248 */
Jeff Brownc38c9be2012-10-04 13:16:19 -07001249 public void keepScreenOnStartedLw();
Daniel Sandler0601eb72011-04-13 01:01:32 -04001250
1251 /**
1252 * Called when we have stopped keeping the screen on because the last window
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 * requesting this is no longer visible.
1254 */
Jeff Brownc38c9be2012-10-04 13:16:19 -07001255 public void keepScreenOnStoppedLw();
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001256
1257 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001258 * Gets the current user rotation mode.
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001259 *
1260 * @return The rotation mode.
1261 *
1262 * @see WindowManagerPolicy#USER_ROTATION_LOCKED
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001263 * @see WindowManagerPolicy#USER_ROTATION_FREE
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001264 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001265 @UserRotationMode
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001266 public int getUserRotationMode();
1267
1268 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001269 * Inform the policy that the user has chosen a preferred orientation ("rotation lock").
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001270 *
1271 * @param mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001272 * {@link WindowManagerPolicy#USER_ROTATION_FREE}.
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001273 * @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90},
Craig Mautner69b08182012-09-05 13:07:13 -07001274 * {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}.
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001275 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001276 public void setUserRotationMode(@UserRotationMode int mode, @Surface.Rotation int rotation);
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001277
1278 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -07001279 * Called when a new system UI visibility is being reported, allowing
1280 * the policy to adjust what is actually reported.
Tor Norbyed9273d62013-05-30 15:59:53 -07001281 * @param visibility The raw visibility reported by the status bar.
Dianne Hackborndf89e652011-10-06 22:35:11 -07001282 * @return The new desired visibility.
1283 */
1284 public int adjustSystemUiVisibilityLw(int visibility);
1285
1286 /**
Daniel Sandler0c4ccff2011-10-19 16:39:14 -04001287 * Specifies whether there is an on-screen navigation bar separate from the status bar.
1288 */
1289 public boolean hasNavigationBar();
1290
1291 /**
Jim Miller93c518e2012-01-17 15:55:31 -08001292 * Lock the device now.
1293 */
Adam Cohenf7522022012-10-03 20:03:18 -07001294 public void lockNow(Bundle options);
Jim Miller93c518e2012-01-17 15:55:31 -08001295
1296 /**
satok1bc0a492012-04-25 22:47:12 +09001297 * Set the last used input method window state. This state is used to make IME transition
1298 * smooth.
1299 * @hide
1300 */
1301 public void setLastInputMethodWindowLw(WindowState ime, WindowState target);
1302
1303 /**
Craig Mautner84984fa2014-06-19 11:19:20 -07001304 * Show the recents task list app.
1305 * @hide
1306 */
1307 public void showRecentApps();
1308
1309 /**
Alan Viverettee34560b22014-07-10 14:50:06 -07001310 * Show the global actions dialog.
1311 * @hide
1312 */
1313 public void showGlobalActions();
1314
1315 /**
Satoshi Kataoka658c7b82013-10-10 17:03:51 +09001316 * @return The current height of the input method window.
1317 */
1318 public int getInputMethodWindowVisibleHeightLw();
1319
1320 /**
Craig Mautnerf1b67412012-09-19 13:18:29 -07001321 * Called when the current user changes. Guaranteed to be called before the broadcast
1322 * of the new user id is made to all listeners.
1323 *
1324 * @param newUserId The id of the incoming user.
1325 */
1326 public void setCurrentUserLw(int newUserId);
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001327
1328 /**
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001329 * Print the WindowManagerPolicy's state into the given stream.
1330 *
1331 * @param prefix Text to print at the front of each line.
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001332 * @param writer The PrintWriter to which you should dump your state. This will be
1333 * closed for you after you return.
1334 * @param args additional arguments to the dump request.
1335 */
Jeff Brownd7a04de2012-06-17 14:17:52 -07001336 public void dump(String prefix, PrintWriter writer, String[] args);
Jim Miller4eeb4f62012-11-08 00:04:29 -08001337
1338 /**
Svetoslav Ganov545252f2012-12-10 18:29:24 -08001339 * Returns whether a given window type can be magnified.
1340 *
1341 * @param windowType The window type.
1342 * @return True if the window can be magnified.
1343 */
1344 public boolean canMagnifyWindow(int windowType);
1345
1346 /**
1347 * Returns whether a given window type is considered a top level one.
1348 * A top level window does not have a container, i.e. attached window,
1349 * or if it has a container it is laid out as a top-level window, not
1350 * as a child of its container.
1351 *
1352 * @param windowType The window type.
1353 * @return True if the window is a top level one.
1354 */
1355 public boolean isTopLevelWindow(int windowType);
Jorim Jaggi0d674622014-05-21 01:34:15 +02001356
1357 /**
1358 * Notifies the keyguard to start fading out.
Jorim Jaggie29b2db2014-05-30 23:17:03 +02001359 *
1360 * @param startTime the start time of the animation in uptime milliseconds
1361 * @param fadeoutDuration the duration of the exit animation, in milliseconds
Jorim Jaggi0d674622014-05-21 01:34:15 +02001362 */
Jorim Jaggie29b2db2014-05-30 23:17:03 +02001363 public void startKeyguardExitAnimation(long startTime, long fadeoutDuration);
Jorim Jaggi737af722015-12-31 10:42:27 +01001364
1365 /**
1366 * Calculates the stable insets without running a layout.
1367 *
1368 * @param displayRotation the current display rotation
Jorim Jaggi737af722015-12-31 10:42:27 +01001369 * @param displayWidth the current display width
1370 * @param displayHeight the current display height
Winson3e874742016-01-07 10:08:17 -08001371 * @param outInsets the insets to return
Jorim Jaggi737af722015-12-31 10:42:27 +01001372 */
1373 public void getStableInsetsLw(int displayRotation, int displayWidth, int displayHeight,
1374 Rect outInsets);
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001375
Jorim Jaggi0ffd49c2016-02-12 15:04:21 -08001376
1377 /**
1378 * @return true if the navigation bar is forced to stay visible
1379 */
1380 public boolean isNavBarForcedShownLw(WindowState win);
1381
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001382 /**
1383 * Calculates the insets for the areas that could never be removed in Honeycomb, i.e. system
1384 * bar or button bar. See {@link #getNonDecorDisplayWidth}.
1385 *
1386 * @param displayRotation the current display rotation
1387 * @param displayWidth the current display width
1388 * @param displayHeight the current display height
1389 * @param outInsets the insets to return
1390 */
1391 public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight,
1392 Rect outInsets);
Jorim Jaggi5060bd82016-02-19 17:12:19 -08001393
1394 /**
1395 * @return True if a specified {@param dockSide} is allowed on the current device, or false
1396 * otherwise. It is guaranteed that at least one dock side for a particular orientation
1397 * is allowed, so for example, if DOCKED_RIGHT is not allowed, DOCKED_LEFT is allowed.
1398 */
1399 public boolean isDockSideAllowed(int dockSide);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001400}