blob: c4ffb4c06a26d42dd9f23e111354ae8615b37a06 [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
Jorim Jaggif12ec0f2017-08-23 16:14:10 +020019import static android.Manifest.permission;
Tarandeep Singhe1cfcf42017-07-10 18:50:00 -070020import static android.view.Display.DEFAULT_DISPLAY;
Wale Ogunwale5cd907d2017-01-26 14:14:08 -080021import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
22import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
23import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
24import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL;
25import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
26import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
27import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY;
28import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
29import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
30import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL;
31import static android.view.WindowManager.LayoutParams.TYPE_BOOT_PROGRESS;
32import static android.view.WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY;
33import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
34import static android.view.WindowManager.LayoutParams.TYPE_DRAG;
35import static android.view.WindowManager.LayoutParams.TYPE_DREAM;
36import static android.view.WindowManager.LayoutParams.TYPE_INPUT_CONSUMER;
37import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
38import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
39import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG;
40import static android.view.WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY;
41import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
42import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
43import static android.view.WindowManager.LayoutParams.TYPE_PHONE;
44import static android.view.WindowManager.LayoutParams.TYPE_POINTER;
45import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION;
46import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
47import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
48import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG;
49import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT;
50import static android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR;
51import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
52import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
53import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL;
54import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL;
55import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
56import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG;
57import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
58import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
59import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
60import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION;
61import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION_STARTING;
62import static android.view.WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY;
63import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
64import static android.view.WindowManager.LayoutParams.isSystemAlertWindowType;
65
Tor Norbyed9273d62013-05-30 15:59:53 -070066import android.annotation.IntDef;
Jorim Jaggi241ae102016-11-02 21:57:33 -070067import android.annotation.Nullable;
Bryce Lee01b0c5f2015-02-05 18:24:04 -080068import android.annotation.SystemApi;
Jorim Jaggi86905582016-02-09 21:36:09 -080069import android.app.ActivityManager.StackId;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070import android.content.Context;
Tor Norbyed9273d62013-05-30 15:59:53 -070071import android.content.pm.ActivityInfo;
Dianne Hackborn2f0b1752011-05-31 17:59:49 -070072import android.content.res.CompatibilityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073import android.content.res.Configuration;
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -070074import android.graphics.Point;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075import android.graphics.Rect;
Adam Cohenf7522022012-10-03 20:03:18 -070076import android.os.Bundle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077import android.os.IBinder;
Dianne Hackborndf89e652011-10-06 22:35:11 -070078import android.os.Looper;
Muyuan Li94ce94e2016-02-24 16:20:54 -080079import android.os.RemoteException;
Wale Ogunwale5cd907d2017-01-26 14:14:08 -080080import android.util.Slog;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081import android.view.animation.Animation;
Aurimas Liutikas67e2ae82016-10-11 18:17:42 -070082
Jorim Jaggi241ae102016-11-02 21:57:33 -070083import com.android.internal.policy.IKeyguardDismissCallback;
Muyuan Li94ce94e2016-02-24 16:20:54 -080084import com.android.internal.policy.IShortcutService;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085
Dianne Hackbornf99f9c52011-01-12 15:49:25 -080086import java.io.PrintWriter;
Tor Norbyed9273d62013-05-30 15:59:53 -070087import java.lang.annotation.Retention;
88import java.lang.annotation.RetentionPolicy;
Dianne Hackbornf99f9c52011-01-12 15:49:25 -080089
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080090/**
91 * This interface supplies all UI-specific behavior of the window manager. An
92 * instance of it is created by the window manager when it starts up, and allows
93 * customization of window layering, special window types, key dispatching, and
94 * layout.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -070095 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 * <p>Because this provides deep interaction with the system window manager,
97 * specific methods on this interface can be called from a variety of contexts
98 * with various restrictions on what they can do. These are encoded through
99 * a suffixes at the end of a method encoding the thread the method is called
100 * from and any locks that are held when it is being called; if no suffix
101 * is attached to a method, then it is not called with any locks and may be
102 * called from the main window manager thread or another thread calling into
103 * the window manager.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700104 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 * <p>The current suffixes are:
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700106 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 * <dl>
108 * <dt> Ti <dd> Called from the input thread. This is the thread that
109 * collects pending input events and dispatches them to the appropriate window.
110 * It may block waiting for events to be processed, so that the input stream is
111 * properly serialized.
112 * <dt> Tq <dd> Called from the low-level input queue thread. This is the
113 * thread that reads events out of the raw input devices and places them
114 * into the global input queue that is read by the <var>Ti</var> thread.
115 * This thread should not block for a long period of time on anything but the
116 * key driver.
117 * <dt> Lw <dd> Called with the main window manager lock held. Because the
118 * window manager is a very low-level system service, there are few other
119 * system services you can call with this lock held. It is explicitly okay to
120 * make calls into the package manager and power manager; it is explicitly not
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -0700121 * okay to make calls into the activity manager or most other services. Note that
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 * {@link android.content.Context#checkPermission(String, int, int)} and
123 * variations require calling into the activity manager.
124 * <dt> Li <dd> Called with the input thread lock held. This lock can be
125 * acquired by the window manager while it holds the window lock, so this is
126 * even more restrictive than <var>Lw</var>.
127 * </dl>
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700128 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 * @hide
130 */
131public interface WindowManagerPolicy {
Jeff Brownb6997262010-10-08 22:31:17 -0700132 // Policy flags. These flags are also defined in frameworks/base/include/ui/Input.h.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133 public final static int FLAG_WAKE = 0x00000001;
Michael Wright337d9d22014-04-22 15:03:48 -0700134 public final static int FLAG_VIRTUAL = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135
Jeff Brown85a31762010-09-01 17:01:00 -0700136 public final static int FLAG_INJECTED = 0x01000000;
Jeff Browne20c9e02010-10-11 14:20:19 -0700137 public final static int FLAG_TRUSTED = 0x02000000;
Jeff Brown0029c662011-03-30 02:25:18 -0700138 public final static int FLAG_FILTERED = 0x04000000;
139 public final static int FLAG_DISABLE_KEY_REPEAT = 0x08000000;
Jeff Brown85a31762010-09-01 17:01:00 -0700140
Jeff Brown037c33e2014-04-09 00:31:55 -0700141 public final static int FLAG_INTERACTIVE = 0x20000000;
Jeff Brownb6997262010-10-08 22:31:17 -0700142 public final static int FLAG_PASS_TO_USER = 0x40000000;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143
Adrian Roosd5c2db62016-03-08 16:11:31 -0800144 // Flags for IActivityManager.keyguardGoingAway()
145 public final static int KEYGUARD_GOING_AWAY_FLAG_TO_SHADE = 1 << 0;
146 public final static int KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS = 1 << 1;
147 public final static int KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER = 1 << 2;
148
Jeff Browndaa37532012-05-01 15:54:03 -0700149 // Flags used for indicating whether the internal and/or external input devices
150 // of some type are available.
151 public final static int PRESENCE_INTERNAL = 1 << 0;
152 public final static int PRESENCE_EXTERNAL = 1 << 1;
153
Andrii Kulian3a1619d2017-07-07 14:38:09 -0700154 // Navigation bar position values
155 int NAV_BAR_LEFT = 1 << 0;
156 int NAV_BAR_RIGHT = 1 << 1;
157 int NAV_BAR_BOTTOM = 1 << 2;
158
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159 public final static boolean WATCH_POINTER = false;
160
Dianne Hackbornad7fa7f2011-01-07 14:06:50 -0800161 /**
162 * Sticky broadcast of the current HDMI plugged state.
163 */
164 public final static String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED";
165
166 /**
167 * Extra in {@link #ACTION_HDMI_PLUGGED} indicating the state: true if
168 * plugged in to HDMI, false if not.
169 */
170 public final static String EXTRA_HDMI_PLUGGED_STATE = "state";
171
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800172 /**
Bryce Lee01b0c5f2015-02-05 18:24:04 -0800173 * Set to {@code true} when intent was invoked from pressing the home key.
174 * @hide
175 */
176 @SystemApi
177 public static final String EXTRA_FROM_HOME_KEY = "android.intent.extra.FROM_HOME_KEY";
178
179 /**
Jeff Brownd5bb82d2011-10-12 13:57:59 -0700180 * Pass this event to the user / app. To be returned from
181 * {@link #interceptKeyBeforeQueueing}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800182 */
183 public final static int ACTION_PASS_TO_USER = 0x00000001;
184
185 /**
Muyuan Li94ce94e2016-02-24 16:20:54 -0800186 * Register shortcuts for window manager to dispatch.
187 * Shortcut code is packed as (metaState << Integer.SIZE) | keyCode
188 * @hide
189 */
190 void registerShortcutKey(long shortcutCode, IShortcutService shortcutKeyReceiver)
191 throws RemoteException;
192
193 /**
Jorim Jaggife762342016-10-13 14:33:27 +0200194 * Called when the Keyguard occluded state changed.
195 * @param occluded Whether Keyguard is currently occluded or not.
Adrian Roosd88eb262016-08-04 14:50:48 -0700196 */
Jorim Jaggife762342016-10-13 14:33:27 +0200197 void onKeyguardOccludedChangedLw(boolean occluded);
Adrian Roosd88eb262016-08-04 14:50:48 -0700198
199 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800200 * Interface to the Window Manager state associated with a particular
201 * window. You can hold on to an instance of this interface from the call
202 * to prepareAddWindow() until removeWindow().
203 */
204 public interface WindowState {
205 /**
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800206 * Return the uid of the app that owns this window.
207 */
208 int getOwningUid();
209
210 /**
211 * Return the package name of the app that owns this window.
212 */
213 String getOwningPackage();
214
215 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800216 * Perform standard frame computation. The result can be obtained with
217 * getFrame() if so desired. Must be called with the window manager
218 * lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700219 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800220 * @param parentFrame The frame of the parent container this window
221 * is in, used for computing its basic position.
222 * @param displayFrame The frame of the overall display in which this
223 * window can appear, used for constraining the overall dimensions
224 * of the window.
Dianne Hackbornc4aad012013-02-22 15:05:25 -0800225 * @param overlayFrame The frame within the display that is inside
226 * of the overlay region.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800227 * @param contentFrame The frame within the display in which we would
228 * like active content to appear. This will cause windows behind to
229 * be resized to match the given content frame.
230 * @param visibleFrame The frame within the display that the window
231 * is actually visible, used for computing its visible insets to be
232 * given to windows behind.
233 * This can be used as a hint for scrolling (avoiding resizing)
234 * the window to make certain that parts of its content
235 * are visible.
John Spurlock46646232013-09-30 22:32:42 -0400236 * @param decorFrame The decor frame specified by policy specific to this window,
237 * to use for proper cropping during animation.
Adrian Roosfa104232014-06-20 16:10:14 -0700238 * @param stableFrame The frame around which stable system decoration is positioned.
Filip Gruszczynski2217f612015-05-26 11:32:08 -0700239 * @param outsetFrame The frame that includes areas that aren't part of the surface but we
240 * want to treat them as such.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800241 */
242 public void computeFrameLw(Rect parentFrame, Rect displayFrame,
Adrian Roosfa104232014-06-20 16:10:14 -0700243 Rect overlayFrame, Rect contentFrame, Rect visibleFrame, Rect decorFrame,
Filip Gruszczynski2217f612015-05-26 11:32:08 -0700244 Rect stableFrame, Rect outsetFrame);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245
246 /**
247 * Retrieve the current frame of the window that has been assigned by
248 * the window manager. Must be called with the window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700249 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 * @return Rect The rectangle holding the window frame.
251 */
252 public Rect getFrameLw();
253
254 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700255 * Retrieve the current position of the window that is actually shown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800256 * Must be called with the window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700257 *
258 * @return Point The point holding the shown window position.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800259 */
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700260 public Point getShownPositionLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800261
262 /**
263 * Retrieve the frame of the display that this window was last
264 * laid out in. Must be called with the
265 * window manager lock held.
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700266 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800267 * @return Rect The rectangle holding the display frame.
268 */
269 public Rect getDisplayFrameLw();
270
271 /**
Dianne Hackbornc4aad012013-02-22 15:05:25 -0800272 * Retrieve the frame of the area inside the overscan region of the
273 * display that this window was last laid out in. Must be called with the
274 * window manager lock held.
275 *
276 * @return Rect The rectangle holding the display overscan frame.
277 */
278 public Rect getOverscanFrameLw();
279
280 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800281 * Retrieve the frame of the content area that this window was last
282 * laid out in. This is the area in which the content of the window
283 * should be placed. It will be smaller than the display frame to
284 * account for screen decorations such as a status bar or soft
285 * keyboard. Must be called with the
286 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700287 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800288 * @return Rect The rectangle holding the content frame.
289 */
290 public Rect getContentFrameLw();
291
292 /**
293 * Retrieve the frame of the visible area that this window was last
294 * laid out in. This is the area of the screen in which the window
295 * will actually be fully visible. It will be smaller than the
296 * content frame to account for transient UI elements blocking it
297 * such as an input method's candidates UI. Must be called with the
298 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700299 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 * @return Rect The rectangle holding the visible frame.
301 */
302 public Rect getVisibleFrameLw();
303
304 /**
305 * Returns true if this window is waiting to receive its given
306 * internal insets from the client app, and so should not impact the
307 * layout of other windows.
308 */
309 public boolean getGivenInsetsPendingLw();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700310
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800311 /**
312 * Retrieve the insets given by this window's client for the content
313 * area of windows behind it. Must be called with the
314 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700315 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 * @return Rect The left, top, right, and bottom insets, relative
317 * to the window's frame, of the actual contents.
318 */
319 public Rect getGivenContentInsetsLw();
320
321 /**
322 * Retrieve the insets given by this window's client for the visible
323 * area of windows behind it. Must be called with the
324 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700325 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 * @return Rect The left, top, right, and bottom insets, relative
327 * to the window's frame, of the actual visible area.
328 */
329 public Rect getGivenVisibleInsetsLw();
330
331 /**
332 * Retrieve the current LayoutParams of the window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700333 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800334 * @return WindowManager.LayoutParams The window's internal LayoutParams
335 * instance.
336 */
337 public WindowManager.LayoutParams getAttrs();
338
339 /**
Dianne Hackborn73ab6a42011-12-13 11:16:23 -0800340 * Return whether this window needs the menu key shown. Must be called
341 * with window lock held, because it may need to traverse down through
342 * window list to determine the result.
343 * @param bottom The bottom-most window to consider when determining this.
344 */
345 public boolean getNeedsMenuLw(WindowState bottom);
346
347 /**
Dianne Hackborn9a230e02011-10-06 11:51:27 -0700348 * Retrieve the current system UI visibility flags associated with
349 * this window.
350 */
351 public int getSystemUiVisibility();
352
353 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 * Get the layer at which this window's surface will be Z-ordered.
355 */
356 public int getSurfaceLayer();
Selim Cinekd6623612015-05-22 18:56:22 -0700357
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800358 /**
Selim Cinekd6623612015-05-22 18:56:22 -0700359 * Retrieve the type of the top-level window.
360 *
361 * @return the base type of the parent window if attached or its own type otherwise
362 */
363 public int getBaseType();
364
365 /**
366 * Return the token for the application (actually activity) that owns
367 * this window. May return null for system windows.
368 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800369 * @return An IApplicationToken identifying the owning activity.
370 */
371 public IApplicationToken getAppToken();
372
373 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700374 * Return true if this window is participating in voice interaction.
375 */
376 public boolean isVoiceInteraction();
377
378 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700379 * Return true if, at any point, the application token associated with
380 * this window has actually displayed any windows. This is most useful
381 * with the "starting up" window to determine if any windows were
382 * displayed when it is closed.
383 *
384 * @return Returns true if one or more windows have been displayed,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 * else false.
386 */
387 public boolean hasAppShownWindows();
388
389 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 * Is this window visible? It is not visible if there is no
391 * surface, or we are in the process of running an exit animation
392 * that will remove the surface.
393 */
394 boolean isVisibleLw();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700395
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700397 * Is this window currently visible to the user on-screen? It is
398 * displayed either if it is visible or it is currently running an
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 * animation before no longer being visible. Must be called with the
400 * window manager lock held.
401 */
402 boolean isDisplayedLw();
403
404 /**
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700405 * Return true if this window (or a window it is attached to, but not
406 * considering its app token) is currently animating.
407 */
Filip Gruszczynski14b4e572015-11-03 15:53:55 -0800408 boolean isAnimatingLw();
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700409
410 /**
Jorim Jaggi23cc9aa2017-05-23 16:05:35 +0200411 * @return Whether the window can affect SystemUI flags, meaning that SystemUI (system bars,
412 * for example) will be affected by the flags specified in this window. This is the
413 * case when the surface is on screen but not exiting.
414 */
415 boolean canAffectSystemUiFlags();
416
417 /**
Dianne Hackborn01b02a72012-01-12 14:05:03 -0800418 * Is this window considered to be gone for purposes of layout?
419 */
420 boolean isGoneForLayoutLw();
421
422 /**
Adrian Roos76d2fe42015-07-09 14:54:08 -0700423 * Returns true if the window has a surface that it has drawn a
424 * complete UI in to. Note that this is different from {@link #hasDrawnLw()}
425 * in that it also returns true if the window is READY_TO_SHOW, but was not yet
426 * promoted to HAS_DRAWN.
427 */
428 boolean isDrawnLw();
429
430 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700431 * Returns true if this window has been shown on screen at some time in
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800432 * the past. Must be called with the window manager lock held.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800433 */
434 public boolean hasDrawnLw();
435
436 /**
437 * Can be called by the policy to force a window to be hidden,
438 * regardless of whether the client or window manager would like
439 * it shown. Must be called with the window manager lock held.
440 * Returns true if {@link #showLw} was last called for the window.
441 */
442 public boolean hideLw(boolean doAnimation);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700443
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 /**
445 * Can be called to undo the effect of {@link #hideLw}, allowing a
446 * window to be shown as long as the window manager and client would
447 * also like it to be shown. Must be called with the window manager
448 * lock held.
449 * Returns true if {@link #hideLw} was last called for the window.
450 */
451 public boolean showLw(boolean doAnimation);
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700452
453 /**
454 * Check whether the process hosting this window is currently alive.
455 */
456 public boolean isAlive();
Craig Mautner69b08182012-09-05 13:07:13 -0700457
458 /**
459 * Check if window is on {@link Display#DEFAULT_DISPLAY}.
460 * @return true if window is on default display.
461 */
462 public boolean isDefaultDisplay();
Adrian Rooscd3884d2015-02-18 17:25:23 +0100463
464 /**
465 * Check whether the window is currently dimming.
466 */
467 public boolean isDimming();
Jorim Jaggi86905582016-02-09 21:36:09 -0800468
469 /**
470 * @return the stack id this windows belongs to, or {@link StackId#INVALID_STACK_ID} if
471 * not attached to any stack.
472 */
473 int getStackId();
Wale Ogunwale9185fb02016-03-11 18:06:14 -0800474
475 /**
476 * Returns true if the window is current in multi-windowing mode. i.e. it shares the
477 * screen with other application windows.
478 */
Andrii Kulian933076d2016-03-29 17:04:42 -0700479 public boolean isInMultiWindowMode();
Robert Carrfd10cd12016-06-29 16:41:50 -0700480
481 public int getRotationAnimationHint();
Jorim Jaggife762342016-10-13 14:33:27 +0200482
483 public boolean isInputMethodWindow();
484
485 public int getDisplayId();
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800486
487 /**
488 * Returns true if the window owner can add internal system windows.
Jorim Jaggif12ec0f2017-08-23 16:14:10 +0200489 * That is, they have {@link permission#INTERNAL_SYSTEM_WINDOW}.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800490 */
491 default boolean canAddInternalSystemWindow() {
492 return false;
493 }
Jorim Jaggif12ec0f2017-08-23 16:14:10 +0200494
495 /**
496 * Returns true if the window owner has the permission to acquire a sleep token when it's
497 * visible. That is, they have the permission {@link permission#DEVICE_POWER}.
498 */
499 boolean canAcquireSleepToken();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 }
501
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700502 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700503 * Representation of a input consumer that the policy has added to the
504 * window manager to consume input events going to windows below it.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700505 */
Selim Cinekf83e8242015-05-19 18:08:14 -0700506 public interface InputConsumer {
Dianne Hackborndf89e652011-10-06 22:35:11 -0700507 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700508 * Remove the input consumer from the window manager.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700509 */
510 void dismiss();
511 }
512
513 /**
Jorim Jaggiba41f4b2016-12-14 17:43:07 -0800514 * Holds the contents of a starting window. {@link #addSplashScreen} needs to wrap the
515 * contents of the starting window into an class implementing this interface, which then will be
Jorim Jaggi02886a82016-12-06 09:10:06 -0800516 * held by WM and released with {@link #remove} when no longer needed.
Jorim Jaggiba41f4b2016-12-14 17:43:07 -0800517 */
518 interface StartingSurface {
Jorim Jaggi02886a82016-12-06 09:10:06 -0800519
520 /**
521 * Removes the starting window surface. Do not hold the window manager lock when calling
522 * this method!
523 */
524 void remove();
Jorim Jaggiba41f4b2016-12-14 17:43:07 -0800525 }
526
527 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700528 * Interface for calling back in to the window manager that is private
529 * between it and the policy.
530 */
531 public interface WindowManagerFuncs {
Jeff Brownac143512012-04-05 18:57:33 -0700532 public static final int LID_ABSENT = -1;
533 public static final int LID_CLOSED = 0;
534 public static final int LID_OPEN = 1;
535
Michael Wright3818c922014-09-02 13:59:07 -0700536 public static final int CAMERA_LENS_COVER_ABSENT = -1;
537 public static final int CAMERA_LENS_UNCOVERED = 0;
538 public static final int CAMERA_LENS_COVERED = 1;
539
Dianne Hackborndf89e652011-10-06 22:35:11 -0700540 /**
541 * Ask the window manager to re-evaluate the system UI flags.
542 */
543 public void reevaluateStatusBarVisibility();
544
545 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700546 * Add a input consumer which will consume all input events going to any window below it.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700547 */
Winson41275482016-10-10 15:17:45 -0700548 public InputConsumer createInputConsumer(Looper looper, String name,
Selim Cinekf83e8242015-05-19 18:08:14 -0700549 InputEventReceiver.Factory inputEventReceiverFactory);
Jeff Brownac143512012-04-05 18:57:33 -0700550
551 /**
552 * Returns a code that describes the current state of the lid switch.
553 */
554 public int getLidState();
555
556 /**
Edward Savage-Jones7def60d2015-11-13 13:27:03 +0100557 * Lock the device now.
558 */
559 public void lockDeviceNow();
560
561 /**
Michael Wright3818c922014-09-02 13:59:07 -0700562 * Returns a code that descripbes whether the camera lens is covered or not.
563 */
564 public int getCameraLensCoverState();
565
566 /**
Yohei Yukawaae61f712015-12-09 13:00:10 -0800567 * Switch the input method, to be precise, input method subtype.
568 *
569 * @param forwardDirection {@code true} to rotate in a forward direction.
570 */
571 public void switchInputMethod(boolean forwardDirection);
572
Jeff Brown9a538ee2012-08-20 14:56:57 -0700573 public void shutdown(boolean confirm);
Alison Cichowlasf8eca402016-08-05 14:50:27 -0400574 public void reboot(boolean confirm);
Jeff Brown9a538ee2012-08-20 14:56:57 -0700575 public void rebootSafeMode(boolean confirm);
John Spurlock04db1762013-05-13 12:46:41 -0400576
577 /**
578 * Return the window manager lock needed to correctly call "Lw" methods.
579 */
580 public Object getWindowManagerLock();
Craig Mautner037aa8d2013-06-07 10:35:44 -0700581
582 /** Register a system listener for touch events */
583 void registerPointerEventListener(PointerEventListener listener);
584
585 /** Unregister a system listener for touch events */
586 void unregisterPointerEventListener(PointerEventListener listener);
Jorim Jaggi81ba11e2016-02-03 22:04:22 -0800587
588 /**
589 * @return The content insets of the docked divider window.
590 */
591 int getDockedDividerInsetsLw();
Jorim Jaggi86905582016-02-09 21:36:09 -0800592
593 /**
594 * Retrieves the {@param outBounds} from the stack with id {@param stackId}.
595 */
596 void getStackBounds(int stackId, Rect outBounds);
Jorim Jaggi77e10432016-10-26 17:43:56 -0700597
598 /**
599 * Notifies window manager that {@link #isShowingDreamLw} has changed.
600 */
601 void notifyShowingDreamChanged();
Jorim Jaggie69c9312016-10-31 18:24:38 -0700602
603 /**
Jorim Jaggi40db0292016-06-27 17:58:03 -0700604 * @return The currently active input method window.
605 */
606 WindowState getInputMethodWindowLw();
607
608 /**
Jorim Jaggie69c9312016-10-31 18:24:38 -0700609 * Notifies window manager that {@link #isKeyguardTrustedLw} has changed.
610 */
611 void notifyKeyguardTrustedChanged();
Jorim Jaggi51304d72017-05-17 17:25:32 +0200612
613 /**
614 * Notifies the window manager that screen is being turned off.
615 *
616 * @param listener callback to call when display can be turned off
617 */
618 void screenTurningOff(ScreenOffListener listener);
Craig Mautner037aa8d2013-06-07 10:35:44 -0700619 }
620
621 public interface PointerEventListener {
622 /**
623 * 1. onPointerEvent will be called on the service.UiThread.
624 * 2. motionEvent will be recycled after onPointerEvent returns so if it is needed later a
625 * copy() must be made and the copy must be recycled.
626 **/
Tarandeep Singhe1cfcf42017-07-10 18:50:00 -0700627 void onPointerEvent(MotionEvent motionEvent);
628
629 /**
630 * @see #onPointerEvent(MotionEvent)
631 **/
632 default void onPointerEvent(MotionEvent motionEvent, int displayId) {
633 if (displayId == DEFAULT_DISPLAY) {
634 onPointerEvent(motionEvent);
635 }
636 }
Dianne Hackborndf89e652011-10-06 22:35:11 -0700637 }
638
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 /** Window has been added to the screen. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800640 public static final int TRANSIT_ENTER = 1;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800641 /** Window has been removed from the screen. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800642 public static final int TRANSIT_EXIT = 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800643 /** Window has been made visible. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800644 public static final int TRANSIT_SHOW = 3;
645 /** Window has been made invisible.
646 * TODO: Consider removal as this is unused. */
647 public static final int TRANSIT_HIDE = 4;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 /** The "application starting" preview window is no longer needed, and will
649 * animate away to show the real window. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800650 public static final int TRANSIT_PREVIEW_DONE = 5;
651
Dianne Hackborn254cb442010-01-27 19:23:59 -0800652 // NOTE: screen off reasons are in order of significance, with more
653 // important ones lower than less important ones.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700654
Dianne Hackborn254cb442010-01-27 19:23:59 -0800655 /** Screen turned off because of a device admin */
656 public final int OFF_BECAUSE_OF_ADMIN = 1;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800657 /** Screen turned off because of power button */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800658 public final int OFF_BECAUSE_OF_USER = 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800659 /** Screen turned off because of timeout */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800660 public final int OFF_BECAUSE_OF_TIMEOUT = 3;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800661
Tor Norbyed9273d62013-05-30 15:59:53 -0700662 /** @hide */
663 @IntDef({USER_ROTATION_FREE, USER_ROTATION_LOCKED})
664 @Retention(RetentionPolicy.SOURCE)
665 public @interface UserRotationMode {}
666
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400667 /** When not otherwise specified by the activity's screenOrientation, rotation should be
668 * determined by the system (that is, using sensors). */
669 public final int USER_ROTATION_FREE = 0;
670 /** When not otherwise specified by the activity's screenOrientation, rotation is set by
671 * the user. */
672 public final int USER_ROTATION_LOCKED = 1;
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700673
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800674 /**
675 * Perform initialization of the policy.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700676 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800677 * @param context The system context we are running in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 */
679 public void init(Context context, IWindowManager windowManager,
Jeff Brown96307042012-07-27 15:51:34 -0700680 WindowManagerFuncs windowManagerFuncs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681
682 /**
Craig Mautner46ac6fa2013-08-01 10:06:34 -0700683 * @return true if com.android.internal.R.bool#config_forceDefaultOrientation is true.
684 */
685 public boolean isDefaultOrientationForced();
686
687 /**
Dianne Hackborn9d132642011-04-21 17:26:39 -0700688 * Called by window manager once it has the initial, default native
689 * display dimensions.
690 */
Dianne Hackborndde331c2012-08-03 14:01:57 -0700691 public void setInitialDisplaySize(Display display, int width, int height, int density);
Dianne Hackborndacea8c2011-04-21 17:26:39 -0700692
Dianne Hackborn9d132642011-04-21 17:26:39 -0700693 /**
Dianne Hackbornc652de82013-02-15 16:32:56 -0800694 * Called by window manager to set the overscan region that should be used for the
695 * given display.
696 */
697 public void setDisplayOverscan(Display display, int left, int top, int right, int bottom);
698
699 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800700 * Check permissions when adding a window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700701 *
Dianne Hackbornc2293022013-02-06 23:14:49 -0800702 * @param attrs The window's LayoutParams.
703 * @param outAppOp First element will be filled with the app op corresponding to
704 * this window, or OP_NONE.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700705 *
Jeff Brown98365d72012-08-19 20:30:52 -0700706 * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800707 * else an error code, usually
Jeff Brown98365d72012-08-19 20:30:52 -0700708 * {@link WindowManagerGlobal#ADD_PERMISSION_DENIED}, to abort the add.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800709 */
Dianne Hackbornc2293022013-02-06 23:14:49 -0800710 public int checkAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711
712 /**
Craig Mautner88400d32012-09-30 12:35:45 -0700713 * Check permissions when adding a window.
714 *
715 * @param attrs The window's LayoutParams.
716 *
717 * @return True if the window may only be shown to the current user, false if the window can
718 * be shown on all users' windows.
719 */
720 public boolean checkShowToOwnerOnly(WindowManager.LayoutParams attrs);
721
722 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800723 * Sanitize the layout parameters coming from a client. Allows the policy
724 * to do things like ensure that windows of a specific type can't take
725 * input focus.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700726 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800727 * @param attrs The window layout parameters to be modified. These values
728 * are modified in-place.
729 */
730 public void adjustWindowParamsLw(WindowManager.LayoutParams attrs);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700731
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800732 /**
733 * After the window manager has computed the current configuration based
734 * on its knowledge of the display and input devices, it gives the policy
735 * a chance to adjust the information contained in it. If you want to
736 * leave it as-is, simply do nothing.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700737 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800738 * <p>This method may be called by any thread in the window manager, but
739 * no internal locks in the window manager will be held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700740 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800741 * @param config The Configuration being computed, for you to change as
742 * desired.
Jeff Browndaa37532012-05-01 15:54:03 -0700743 * @param keyboardPresence Flags that indicate whether internal or external
744 * keyboards are present.
745 * @param navigationPresence Flags that indicate whether internal or external
746 * navigation devices are present.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800747 */
Jeff Browndaa37532012-05-01 15:54:03 -0700748 public void adjustConfigurationLw(Configuration config, int keyboardPresence,
749 int navigationPresence);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700750
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800751 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800752 * Returns the layer assignment for the window state. Allows you to control how different
753 * kinds of windows are ordered on-screen.
754 *
755 * @param win The window state
756 * @return int An arbitrary integer used to order windows, with lower numbers below higher ones.
757 */
758 default int getWindowLayerLw(WindowState win) {
759 return getWindowLayerFromTypeLw(win.getBaseType(), win.canAddInternalSystemWindow());
760 }
761
762 /**
763 * Returns the layer assignment for the window type. Allows you to control how different
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 * kinds of windows are ordered on-screen.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700765 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800766 * @param type The type of window being assigned.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800767 * @return int An arbitrary integer used to order windows, with lower numbers below higher ones.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800768 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800769 default int getWindowLayerFromTypeLw(int type) {
770 if (isSystemAlertWindowType(type)) {
771 throw new IllegalArgumentException("Use getWindowLayerFromTypeLw() or"
772 + " getWindowLayerLw() for alert window types");
773 }
774 return getWindowLayerFromTypeLw(type, false /* canAddInternalSystemWindow */);
775 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800776
777 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800778 * Returns the layer assignment for the window type. Allows you to control how different
779 * kinds of windows are ordered on-screen.
780 *
781 * @param type The type of window being assigned.
782 * @param canAddInternalSystemWindow If the owner window associated with the type we are
783 * evaluating can add internal system windows. I.e they have
Jorim Jaggif12ec0f2017-08-23 16:14:10 +0200784 * {@link permission#INTERNAL_SYSTEM_WINDOW}. If true, alert window
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800785 * types {@link android.view.WindowManager.LayoutParams#isSystemAlertWindowType(int)}
786 * can be assigned layers greater than the layer for
787 * {@link android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY} Else, their
788 * layers would be lesser.
789 * @return int An arbitrary integer used to order windows, with lower numbers below higher ones.
790 */
791 default int getWindowLayerFromTypeLw(int type, boolean canAddInternalSystemWindow) {
792 if (type >= FIRST_APPLICATION_WINDOW && type <= LAST_APPLICATION_WINDOW) {
793 return APPLICATION_LAYER;
794 }
795
796 switch (type) {
797 case TYPE_WALLPAPER:
798 // wallpaper is at the bottom, though the window manager may move it.
799 return 1;
800 case TYPE_PRESENTATION:
801 case TYPE_PRIVATE_PRESENTATION:
802 return APPLICATION_LAYER;
803 case TYPE_DOCK_DIVIDER:
804 return APPLICATION_LAYER;
805 case TYPE_QS_DIALOG:
806 return APPLICATION_LAYER;
807 case TYPE_PHONE:
808 return 3;
809 case TYPE_SEARCH_BAR:
810 case TYPE_VOICE_INTERACTION_STARTING:
811 return 4;
812 case TYPE_VOICE_INTERACTION:
813 // voice interaction layer is almost immediately above apps.
814 return 5;
815 case TYPE_INPUT_CONSUMER:
816 return 6;
817 case TYPE_SYSTEM_DIALOG:
818 return 7;
819 case TYPE_TOAST:
820 // toasts and the plugged-in battery thing
821 return 8;
822 case TYPE_PRIORITY_PHONE:
823 // SIM errors and unlock. Not sure if this really should be in a high layer.
824 return 9;
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800825 case TYPE_SYSTEM_ALERT:
826 // like the ANR / app crashed dialogs
827 return canAddInternalSystemWindow ? 11 : 10;
828 case TYPE_APPLICATION_OVERLAY:
Wale Ogunwaled993a572017-02-05 13:52:09 -0800829 return 12;
830 case TYPE_DREAM:
831 // used for Dreams (screensavers with TYPE_DREAM windows)
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800832 return 13;
833 case TYPE_INPUT_METHOD:
834 // on-screen keyboards and other such input method user interfaces go here.
835 return 14;
836 case TYPE_INPUT_METHOD_DIALOG:
837 // on-screen keyboards and other such input method user interfaces go here.
838 return 15;
839 case TYPE_STATUS_BAR_SUB_PANEL:
840 return 17;
841 case TYPE_STATUS_BAR:
842 return 18;
843 case TYPE_STATUS_BAR_PANEL:
844 return 19;
845 case TYPE_KEYGUARD_DIALOG:
846 return 20;
847 case TYPE_VOLUME_OVERLAY:
848 // the on-screen volume indicator and controller shown when the user
849 // changes the device volume
850 return 21;
851 case TYPE_SYSTEM_OVERLAY:
852 // the on-screen volume indicator and controller shown when the user
853 // changes the device volume
854 return canAddInternalSystemWindow ? 22 : 11;
855 case TYPE_NAVIGATION_BAR:
856 // the navigation bar, if available, shows atop most things
857 return 23;
858 case TYPE_NAVIGATION_BAR_PANEL:
859 // some panels (e.g. search) need to show on top of the navigation bar
860 return 24;
861 case TYPE_SCREENSHOT:
862 // screenshot selection layer shouldn't go above system error, but it should cover
863 // navigation bars at the very least.
864 return 25;
865 case TYPE_SYSTEM_ERROR:
866 // system-level error dialogs
867 return canAddInternalSystemWindow ? 26 : 10;
868 case TYPE_MAGNIFICATION_OVERLAY:
869 // used to highlight the magnified portion of a display
870 return 27;
871 case TYPE_DISPLAY_OVERLAY:
872 // used to simulate secondary display devices
873 return 28;
874 case TYPE_DRAG:
875 // the drag layer: input for drag-and-drop is associated with this window,
876 // which sits above all other focusable windows
877 return 29;
878 case TYPE_ACCESSIBILITY_OVERLAY:
879 // overlay put by accessibility services to intercept user interaction
880 return 30;
881 case TYPE_SECURE_SYSTEM_OVERLAY:
882 return 31;
883 case TYPE_BOOT_PROGRESS:
884 return 32;
885 case TYPE_POINTER:
886 // the (mouse) pointer layer
887 return 33;
888 default:
889 Slog.e("WindowManager", "Unknown window type: " + type);
890 return APPLICATION_LAYER;
891 }
892 }
893
894 int APPLICATION_LAYER = 2;
895 int APPLICATION_MEDIA_SUBLAYER = -2;
896 int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1;
897 int APPLICATION_PANEL_SUBLAYER = 1;
898 int APPLICATION_SUB_PANEL_SUBLAYER = 2;
899 int APPLICATION_ABOVE_SUB_PANEL_SUBLAYER = 3;
900
901 /**
902 * Return how to Z-order sub-windows in relation to the window they are attached to.
903 * Return positive to have them ordered in front, negative for behind.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700904 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905 * @param type The sub-window type code.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700906 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800907 * @return int Layer in relation to the attached window, where positive is
908 * above and negative is below.
909 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800910 default int getSubWindowLayerFromTypeLw(int type) {
911 switch (type) {
912 case TYPE_APPLICATION_PANEL:
913 case TYPE_APPLICATION_ATTACHED_DIALOG:
914 return APPLICATION_PANEL_SUBLAYER;
915 case TYPE_APPLICATION_MEDIA:
916 return APPLICATION_MEDIA_SUBLAYER;
917 case TYPE_APPLICATION_MEDIA_OVERLAY:
918 return APPLICATION_MEDIA_OVERLAY_SUBLAYER;
919 case TYPE_APPLICATION_SUB_PANEL:
920 return APPLICATION_SUB_PANEL_SUBLAYER;
921 case TYPE_APPLICATION_ABOVE_SUB_PANEL:
922 return APPLICATION_ABOVE_SUB_PANEL_SUBLAYER;
923 }
924 Slog.e("WindowManager", "Unknown sub-window type: " + type);
925 return 0;
926 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800927
928 /**
Dianne Hackborn6136b7e2009-09-18 01:53:49 -0700929 * Get the highest layer (actually one more than) that the wallpaper is
930 * allowed to be in.
931 */
932 public int getMaxWallpaperLayer();
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700933
934 /**
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700935 * Return the display width available after excluding any screen
Jorim Jaggi82c9dc92016-02-05 15:10:33 -0800936 * decorations that could never be removed in Honeycomb. That is, system bar or
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700937 * button bar.
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400938 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800939 public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation,
Andrii Kuliandb8e1062016-11-15 18:30:27 -0800940 int uiMode, int displayId);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400941
942 /**
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700943 * Return the display height available after excluding any screen
Jorim Jaggi82c9dc92016-02-05 15:10:33 -0800944 * decorations that could never be removed in Honeycomb. That is, system bar or
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700945 * button bar.
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400946 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800947 public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation,
Andrii Kuliandb8e1062016-11-15 18:30:27 -0800948 int uiMode, int displayId);
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700949
950 /**
951 * Return the available screen width that we should report for the
952 * configuration. This must be no larger than
Craig Mautner61ac6bb2012-02-02 17:29:33 -0800953 * {@link #getNonDecorDisplayWidth(int, int, int)}; it may be smaller than
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700954 * that to account for more transient decoration like a status bar.
955 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800956 public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation,
Andrii Kuliandb8e1062016-11-15 18:30:27 -0800957 int uiMode, int displayId);
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700958
959 /**
960 * Return the available screen height that we should report for the
961 * configuration. This must be no larger than
Craig Mautner61ac6bb2012-02-02 17:29:33 -0800962 * {@link #getNonDecorDisplayHeight(int, int, int)}; it may be smaller than
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700963 * that to account for more transient decoration like a status bar.
964 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800965 public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation,
Andrii Kuliandb8e1062016-11-15 18:30:27 -0800966 int uiMode, int displayId);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400967
968 /**
Jorim Jaggife762342016-10-13 14:33:27 +0200969 * Return whether the given window can become the Keyguard window. Typically returns true for
970 * the StatusBar.
Jorim Jaggi0d674622014-05-21 01:34:15 +0200971 */
972 public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs);
973
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700974 /**
Jorim Jaggife762342016-10-13 14:33:27 +0200975 * @return whether {@param win} can be hidden by Keyguard
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700976 */
Jorim Jaggife762342016-10-13 14:33:27 +0200977 public boolean canBeHiddenByKeyguardLw(WindowState win);
Craig Mautner7d7808f2014-09-11 18:02:38 -0700978
979 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800980 * Called when the system would like to show a UI to indicate that an
981 * application is starting. You can use this to add a
982 * APPLICATION_STARTING_TYPE window with the given appToken to the window
983 * manager (using the normal window manager APIs) that will be shown until
984 * the application displays its own window. This is called without the
985 * window manager locked so that you can call back into it.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700986 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800987 * @param appToken Token of the application being started.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700988 * @param packageName The name of the application package being started.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800989 * @param theme Resource defining the application's overall visual theme.
990 * @param nonLocalizedLabel The default title label of the application if
991 * no data is found in the resource.
992 * @param labelRes The resource ID the application would like to use as its name.
993 * @param icon The resource ID the application would like to use as its icon.
Dianne Hackborn7eec10e2010-11-12 18:03:47 -0800994 * @param windowFlags Window layout flags.
Wale Ogunwaledfc18622016-04-16 15:08:48 -0700995 * @param overrideConfig override configuration to consider when generating
996 * context to for resources.
Andrii Kulianfb1bf692017-01-17 11:17:34 -0800997 * @param displayId Id of the display to show the splash screen at.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700998 *
Jorim Jaggi02886a82016-12-06 09:10:06 -0800999 * @return The starting surface.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001000 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 */
Jorim Jaggiba41f4b2016-12-14 17:43:07 -08001002 public StartingSurface addSplashScreen(IBinder appToken, String packageName, int theme,
1003 CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon,
Andrii Kulianfb1bf692017-01-17 11:17:34 -08001004 int logo, int windowFlags, Configuration overrideConfig, int displayId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001005
1006 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001007 * Prepare for a window being added to the window manager. You can throw an
1008 * exception here to prevent the window being added, or do whatever setup
1009 * you need to keep track of the window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001010 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001011 * @param win The window being added.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001012 * @param attrs The window's LayoutParams.
1013 *
Jeff Brown98365d72012-08-19 20:30:52 -07001014 * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed, else an
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 * error code to abort the add.
1016 */
1017 public int prepareAddWindowLw(WindowState win,
1018 WindowManager.LayoutParams attrs);
1019
1020 /**
1021 * Called when a window is being removed from a window manager. Must not
1022 * throw an exception -- clean up as much as possible.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001023 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001024 * @param win The window being removed.
1025 */
1026 public void removeWindowLw(WindowState win);
1027
1028 /**
1029 * Control the animation to run when a window's state changes. Return a
1030 * non-0 number to force the animation to a specific resource ID, or 0
1031 * to use the default animation.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001032 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001033 * @param win The window that is changing.
1034 * @param transit What is happening to the window: {@link #TRANSIT_ENTER},
1035 * {@link #TRANSIT_EXIT}, {@link #TRANSIT_SHOW}, or
1036 * {@link #TRANSIT_HIDE}.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001037 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001038 * @return Resource ID of the actual animation to use, or 0 for none.
1039 */
1040 public int selectAnimationLw(WindowState win, int transit);
1041
1042 /**
Craig Mautner3c174372013-02-21 17:54:37 -08001043 * Determine the animation to run for a rotation transition based on the
1044 * top fullscreen windows {@link WindowManager.LayoutParams#rotationAnimation}
1045 * and whether it is currently fullscreen and frontmost.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001046 *
1047 * @param anim The exiting animation resource id is stored in anim[0], the
Craig Mautner3c174372013-02-21 17:54:37 -08001048 * entering animation resource id is stored in anim[1].
1049 */
1050 public void selectRotationAnimationLw(int anim[]);
1051
1052 /**
1053 * Validate whether the current top fullscreen has specified the same
1054 * {@link WindowManager.LayoutParams#rotationAnimation} value as that
1055 * being passed in from the previous top fullscreen window.
1056 *
1057 * @param exitAnimId exiting resource id from the previous window.
1058 * @param enterAnimId entering resource id from the previous window.
1059 * @param forceDefault For rotation animations only, if true ignore the
1060 * animation values and just return false.
1061 * @return true if the previous values are still valid, false if they
1062 * should be replaced with the default.
1063 */
1064 public boolean validateRotationAnimationLw(int exitAnimId, int enterAnimId,
1065 boolean forceDefault);
1066
1067 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001068 * Create and return an animation to re-display a window that was force hidden by Keyguard.
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001069 */
Jorim Jaggife762342016-10-13 14:33:27 +02001070 public Animation createHiddenByKeyguardExit(boolean onWallpaper,
Jorim Jaggi84a3e7a2014-08-13 17:58:58 +02001071 boolean goingToNotificationShade);
Jorim Jaggi76a16232014-08-08 17:00:47 +02001072
1073 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001074 * Create and return an animation to let the wallpaper disappear after being shown behind
1075 * Keyguard.
Jorim Jaggi76a16232014-08-08 17:00:47 +02001076 */
Jorim Jaggife762342016-10-13 14:33:27 +02001077 public Animation createKeyguardWallpaperExit(boolean goingToNotificationShade);
Jorim Jaggi76a16232014-08-08 17:00:47 +02001078
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001079 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001080 * Called from the input reader thread before a key is enqueued.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 *
1082 * <p>There are some actions that need to be handled here because they
1083 * affect the power state of the device, for example, the power keys.
1084 * Generally, it's best to keep as little as possible in the queue thread
1085 * because it's the most fragile.
Jeff Brown1f245102010-11-18 20:53:46 -08001086 * @param event The key event.
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001087 * @param policyFlags The policy flags associated with the key.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001088 *
Jeff Brown26875502014-01-30 21:47:47 -08001089 * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001090 */
Jeff Brown037c33e2014-04-09 00:31:55 -07001091 public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags);
Jeff Brown56194eb2011-03-02 19:23:13 -08001092
1093 /**
Michael Wright70af00a2014-09-03 19:30:20 -07001094 * Called from the input reader thread before a motion is enqueued when the device is in a
1095 * non-interactive state.
Jeff Brown56194eb2011-03-02 19:23:13 -08001096 *
1097 * <p>There are some actions that need to be handled here because they
1098 * affect the power state of the device, for example, waking on motions.
1099 * Generally, it's best to keep as little as possible in the queue thread
1100 * because it's the most fragile.
1101 * @param policyFlags The policy flags associated with the motion.
1102 *
Jeff Brown26875502014-01-30 21:47:47 -08001103 * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
Jeff Brown56194eb2011-03-02 19:23:13 -08001104 */
Michael Wright70af00a2014-09-03 19:30:20 -07001105 public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags);
Jeff Brown56194eb2011-03-02 19:23:13 -08001106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001107 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001108 * Called from the input dispatcher thread before a key is dispatched to a window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001109 *
1110 * <p>Allows you to define
Jeff Brown3915bb82010-11-05 15:02:16 -07001111 * behavior for keys that can not be overridden by applications.
1112 * This method is called from the input thread, with no locks held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001113 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001114 * @param win The window that currently has focus. This is where the key
1115 * event will normally go.
Jeff Brown1f245102010-11-18 20:53:46 -08001116 * @param event The key event.
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001117 * @param policyFlags The policy flags associated with the key.
Jeff Brownd5bb82d2011-10-12 13:57:59 -07001118 * @return 0 if the key should be dispatched immediately, -1 if the key should
1119 * not be dispatched ever, or a positive value indicating the number of
1120 * milliseconds by which the key dispatch should be delayed before trying
1121 * again.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 */
Jeff Brownd5bb82d2011-10-12 13:57:59 -07001123 public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001124
1125 /**
Jeff Brown3915bb82010-11-05 15:02:16 -07001126 * Called from the input dispatcher thread when an application did not handle
1127 * a key that was dispatched to it.
1128 *
1129 * <p>Allows you to define default global behavior for keys that were not handled
1130 * by applications. This method is called from the input thread, with no locks held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001131 *
Jeff Brown3915bb82010-11-05 15:02:16 -07001132 * @param win The window that currently has focus. This is where the key
1133 * event will normally go.
Jeff Brown1f245102010-11-18 20:53:46 -08001134 * @param event The key event.
Jeff Brown3915bb82010-11-05 15:02:16 -07001135 * @param policyFlags The policy flags associated with the key.
Jeff Brown49ed71d2010-12-06 17:13:33 -08001136 * @return Returns an alternate key event to redispatch as a fallback, or null to give up.
1137 * The caller is responsible for recycling the key event.
Jeff Brown3915bb82010-11-05 15:02:16 -07001138 */
Jeff Brown49ed71d2010-12-06 17:13:33 -08001139 public KeyEvent dispatchUnhandledKey(WindowState win, KeyEvent event, int policyFlags);
Jeff Brown3915bb82010-11-05 15:02:16 -07001140
1141 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001142 * Called when layout of the windows is about to start.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001143 *
Craig Mautner69b08182012-09-05 13:07:13 -07001144 * @param isDefaultDisplay true if window is on {@link Display#DEFAULT_DISPLAY}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001145 * @param displayWidth The current full width of the screen.
1146 * @param displayHeight The current full height of the screen.
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -08001147 * @param displayRotation The current rotation being applied to the base window.
1148 * @param uiMode The current uiMode in configuration.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001149 */
Craig Mautner69b08182012-09-05 13:07:13 -07001150 public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight,
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -08001151 int displayRotation, int uiMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152
1153 /**
John Spurlock46646232013-09-30 22:32:42 -04001154 * Returns the bottom-most layer of the system decor, above which no policy decor should
1155 * be applied.
Dianne Hackborn85afd1b2012-05-13 13:31:06 -07001156 */
John Spurlock46646232013-09-30 22:32:42 -04001157 public int getSystemDecorLayerLw();
Dianne Hackborn85afd1b2012-05-13 13:31:06 -07001158
1159 /**
Craig Mautner967212c2013-04-13 21:10:58 -07001160 * Return the rectangle of the screen that is available for applications to run in.
1161 * This will be called immediately after {@link #beginLayoutLw}.
1162 *
1163 * @param r The rectangle to be filled with the boundaries available to applications.
1164 */
1165 public void getContentRectLw(Rect r);
1166
1167 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001168 * Called for each window attached to the window manager as layout is
1169 * proceeding. The implementation of this function must take care of
1170 * setting the window's frame, either here or in finishLayout().
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001171 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001172 * @param win The window being positioned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 * @param attached For sub-windows, the window it is attached to; this
1174 * window will already have had layoutWindow() called on it
1175 * so you can use its Rect. Otherwise null.
1176 */
Craig Mautnerc9457fa2014-06-06 14:27:48 -07001177 public void layoutWindowLw(WindowState win, WindowState attached);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001178
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001179
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001180 /**
1181 * Return the insets for the areas covered by system windows. These values
1182 * are computed on the most recent layout, so they are not guaranteed to
1183 * be correct.
Adrian Roos37d7a682014-11-06 18:15:16 +01001184 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001185 * @param attrs The LayoutParams of the window.
Jorim Jaggi23bf5462016-05-13 15:24:39 -07001186 * @param taskBounds The bounds of the task this window is on or {@code null} if no task is
1187 * associated with the window.
1188 * @param displayRotation Rotation of the display.
1189 * @param displayWidth The width of the display.
1190 * @param displayHeight The height of the display.
Adrian Roos37d7a682014-11-06 18:15:16 +01001191 * @param outContentInsets The areas covered by system windows, expressed as positive insets.
1192 * @param outStableInsets The areas covered by stable system windows irrespective of their
1193 * current visibility. Expressed as positive insets.
Filip Gruszczynski0ec13282015-06-25 11:26:01 -07001194 * @param outOutsets The areas that are not real display, but we would like to treat as such.
Jorim Jaggi0ffd49c2016-02-12 15:04:21 -08001195 * @return Whether to always consume the navigation bar.
1196 * See {@link #isNavBarForcedShownLw(WindowState)}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001197 */
Jorim Jaggi23bf5462016-05-13 15:24:39 -07001198 public boolean getInsetHintLw(WindowManager.LayoutParams attrs, Rect taskBounds,
1199 int displayRotation, int displayWidth, int displayHeight, Rect outContentInsets,
1200 Rect outStableInsets, Rect outOutsets);
Dianne Hackborn85afd1b2012-05-13 13:31:06 -07001201
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 /**
1203 * Called when layout of the windows is finished. After this function has
1204 * returned, all windows given to layoutWindow() <em>must</em> have had a
1205 * frame assigned.
1206 */
Craig Mautner61ac6bb2012-02-02 17:29:33 -08001207 public void finishLayoutLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001208
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001209 /** Layout state may have changed (so another layout will be performed) */
1210 static final int FINISH_LAYOUT_REDO_LAYOUT = 0x0001;
1211 /** Configuration state may have changed */
1212 static final int FINISH_LAYOUT_REDO_CONFIG = 0x0002;
1213 /** Wallpaper may need to move */
1214 static final int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004;
Dianne Hackbornb8b11a02010-03-10 15:53:11 -08001215 /** Need to recompute animations */
1216 static final int FINISH_LAYOUT_REDO_ANIM = 0x0008;
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001217
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 /**
Craig Mautner39834192012-09-02 07:47:24 -07001219 * Called following layout of all windows before each window has policy applied.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001220 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001221 * @param displayWidth The current full width of the screen.
1222 * @param displayHeight The current full height of the screen.
1223 */
Craig Mautner39834192012-09-02 07:47:24 -07001224 public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001225
1226 /**
Craig Mautner39834192012-09-02 07:47:24 -07001227 * Called following layout of all window to apply policy to each window.
Yohei Yukawad1a09222015-06-30 16:22:05 -07001228 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001229 * @param win The window being positioned.
Yohei Yukawad1a09222015-06-30 16:22:05 -07001230 * @param attrs The LayoutParams of the window.
1231 * @param attached For sub-windows, the window it is attached to. Otherwise null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001232 */
Craig Mautner39834192012-09-02 07:47:24 -07001233 public void applyPostLayoutPolicyLw(WindowState win,
Jorim Jaggife762342016-10-13 14:33:27 +02001234 WindowManager.LayoutParams attrs, WindowState attached, WindowState imeTarget);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235
1236 /**
Craig Mautner39834192012-09-02 07:47:24 -07001237 * Called following layout of all windows and after policy has been applied
1238 * to each window. If in this function you do
1239 * something that may have modified the animation state of another window,
1240 * be sure to return non-zero in order to perform another pass through layout.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001241 *
Dianne Hackbornb8b11a02010-03-10 15:53:11 -08001242 * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT},
1243 * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER},
1244 * or {@link #FINISH_LAYOUT_REDO_ANIM}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001245 */
Craig Mautner39834192012-09-02 07:47:24 -07001246 public int finishPostLayoutPolicyLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247
1248 /**
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001249 * Return true if it is okay to perform animations for an app transition
1250 * that is about to occur. You may return false for this if, for example,
1251 * the lock screen is currently displayed so the switch should happen
1252 * immediately.
1253 */
1254 public boolean allowAppAnimationsLw();
Joe Onorato664644d2011-01-23 17:53:23 -08001255
1256
1257 /**
1258 * A new window has been focused.
1259 */
Dianne Hackborndf89e652011-10-06 22:35:11 -07001260 public int focusChangedLw(WindowState lastFocus, WindowState newFocus);
Jeff Brown36c4db82014-09-19 12:05:31 -07001261
1262 /**
Jeff Brown416c49c2015-05-26 19:50:18 -07001263 * Called when the device has started waking up.
Jeff Brown36c4db82014-09-19 12:05:31 -07001264 */
Jeff Brown416c49c2015-05-26 19:50:18 -07001265 public void startedWakingUp();
Jeff Brown36c4db82014-09-19 12:05:31 -07001266
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001267 /**
Jeff Brown416c49c2015-05-26 19:50:18 -07001268 * Called when the device has finished waking up.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001269 */
Jeff Brown416c49c2015-05-26 19:50:18 -07001270 public void finishedWakingUp();
1271
1272 /**
1273 * Called when the device has started going to sleep.
1274 *
1275 * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN},
1276 * or {@link #OFF_BECAUSE_OF_TIMEOUT}.
1277 */
1278 public void startedGoingToSleep(int why);
1279
1280 /**
1281 * Called when the device has finished going to sleep.
1282 *
1283 * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN},
1284 * or {@link #OFF_BECAUSE_OF_TIMEOUT}.
1285 */
1286 public void finishedGoingToSleep(int why);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001287
Jeff Brown36c4db82014-09-19 12:05:31 -07001288 /**
1289 * Called when the device is about to turn on the screen to show content.
1290 * When waking up, this method will be called once after the call to wakingUp().
1291 * When dozing, the method will be called sometime after the call to goingToSleep() and
1292 * may be called repeatedly in the case where the screen is pulsing on and off.
1293 *
1294 * Must call back on the listener to tell it when the higher-level system
1295 * is ready for the screen to go on (i.e. the lock screen is shown).
1296 */
1297 public void screenTurningOn(ScreenOnListener screenOnListener);
1298
Jeff Brown3ee549c2014-09-22 20:14:39 -07001299 /**
Jorim Jaggi0d210f62015-07-10 14:24:44 -07001300 * Called when the device has actually turned on the screen, i.e. the display power state has
1301 * been set to ON and the screen is unblocked.
1302 */
1303 public void screenTurnedOn();
1304
1305 /**
Jorim Jaggi51304d72017-05-17 17:25:32 +02001306 * Called when the display would like to be turned off. This gives policy a chance to do some
1307 * things before the display power state is actually changed to off.
1308 *
1309 * @param screenOffListener Must be called to tell that the display power state can actually be
1310 * changed now after policy has done its work.
1311 */
1312 public void screenTurningOff(ScreenOffListener screenOffListener);
1313
1314 /**
Jeff Brown3ee549c2014-09-22 20:14:39 -07001315 * Called when the device has turned the screen off.
1316 */
1317 public void screenTurnedOff();
1318
Dianne Hackborn38e29a62011-09-18 14:43:08 -07001319 public interface ScreenOnListener {
1320 void onScreenOn();
Craig Mautner61ac6bb2012-02-02 17:29:33 -08001321 }
Dianne Hackborn38e29a62011-09-18 14:43:08 -07001322
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001323 /**
Jorim Jaggi51304d72017-05-17 17:25:32 +02001324 * See {@link #screenTurnedOff}
1325 */
1326 public interface ScreenOffListener {
1327 void onScreenOff();
1328 }
1329
1330 /**
Jeff Brown3ee549c2014-09-22 20:14:39 -07001331 * Return whether the default display is on and not blocked by a black surface.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001332 */
Jeff Brown3ee549c2014-09-22 20:14:39 -07001333 public boolean isScreenOn();
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001334
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001335 /**
Adrian Roos7c894802017-07-19 12:25:34 +02001336 * @return whether the device is currently allowed to animate.
Adrian Roose94c15c2017-05-09 13:17:54 -07001337 *
Adrian Roos7c894802017-07-19 12:25:34 +02001338 * Note: this can be true even if it is not appropriate to animate for reasons that are outside
1339 * of the policy's authority.
Adrian Roose94c15c2017-05-09 13:17:54 -07001340 */
Adrian Roos7c894802017-07-19 12:25:34 +02001341 boolean okToAnimate();
Adrian Roose94c15c2017-05-09 13:17:54 -07001342
1343 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001344 * Tell the policy that the lid switch has changed state.
1345 * @param whenNanos The time when the change occurred in uptime nanoseconds.
1346 * @param lidOpen True if the lid is now open.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001347 */
Jeff Brown46b9ac02010-04-22 18:58:52 -07001348 public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen);
Michael Wright3818c922014-09-02 13:59:07 -07001349
1350 /**
1351 * Tell the policy that the camera lens has been covered or uncovered.
1352 * @param whenNanos The time when the change occurred in uptime nanoseconds.
1353 * @param lensCovered True if the lens is covered.
1354 */
1355 public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered);
1356
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001357 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 * Tell the policy if anyone is requesting that keyguard not come on.
1359 *
1360 * @param enabled Whether keyguard can be on or not. does not actually
1361 * turn it on, unless it was previously disabled with this function.
1362 *
1363 * @see android.app.KeyguardManager.KeyguardLock#disableKeyguard()
1364 * @see android.app.KeyguardManager.KeyguardLock#reenableKeyguard()
1365 */
Craig Mautner3c174372013-02-21 17:54:37 -08001366 @SuppressWarnings("javadoc")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001367 public void enableKeyguard(boolean enabled);
1368
1369 /**
1370 * Callback used by {@link WindowManagerPolicy#exitKeyguardSecurely}
1371 */
1372 interface OnKeyguardExitResult {
1373 void onKeyguardExitResult(boolean success);
1374 }
1375
1376 /**
1377 * Tell the policy if anyone is requesting the keyguard to exit securely
1378 * (this would be called after the keyguard was disabled)
1379 * @param callback Callback to send the result back.
1380 * @see android.app.KeyguardManager#exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult)
1381 */
Craig Mautner3c174372013-02-21 17:54:37 -08001382 @SuppressWarnings("javadoc")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001383 void exitKeyguardSecurely(OnKeyguardExitResult callback);
1384
1385 /**
Mike Lockwood520d8bc2011-02-18 13:23:13 -05001386 * isKeyguardLocked
1387 *
1388 * Return whether the keyguard is currently locked.
1389 *
1390 * @return true if in keyguard is locked.
1391 */
1392 public boolean isKeyguardLocked();
1393
1394 /**
1395 * isKeyguardSecure
1396 *
1397 * Return whether the keyguard requires a password to unlock.
Jim Millere4044bb2016-05-10 18:38:25 -07001398 * @param userId
Mike Lockwood520d8bc2011-02-18 13:23:13 -05001399 *
1400 * @return true if in keyguard is secure.
1401 */
Jim Millere4044bb2016-05-10 18:38:25 -07001402 public boolean isKeyguardSecure(int userId);
Mike Lockwood520d8bc2011-02-18 13:23:13 -05001403
1404 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001405 * Return whether the keyguard is currently occluded.
Adrian Roos461829d2015-06-03 14:41:18 -07001406 *
Jorim Jaggife762342016-10-13 14:33:27 +02001407 * @return true if in keyguard is occluded, false otherwise
Adrian Roos461829d2015-06-03 14:41:18 -07001408 */
Jorim Jaggife762342016-10-13 14:33:27 +02001409 public boolean isKeyguardOccluded();
Adrian Roos461829d2015-06-03 14:41:18 -07001410
1411 /**
Tony Mak2c0d6dc2016-04-29 16:16:54 +01001412 * @return true if in keyguard is on and not occluded.
1413 */
1414 public boolean isKeyguardShowingAndNotOccluded();
1415
1416 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001417 * @return whether Keyguard is in trusted state and can be dismissed without credentials
1418 */
1419 public boolean isKeyguardTrustedLw();
1420
1421 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 * inKeyguardRestrictedKeyInputMode
1423 *
1424 * if keyguard screen is showing or in restricted key input mode (i.e. in
1425 * keyguard password emergency screen). When in such mode, certain keys,
1426 * such as the Home key and the right soft keys, don't work.
1427 *
1428 * @return true if in keyguard restricted input mode.
1429 */
1430 public boolean inKeyguardRestrictedKeyInputMode();
1431
1432 /**
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001433 * Ask the policy to dismiss the keyguard, if it is currently shown.
Jorim Jaggi241ae102016-11-02 21:57:33 -07001434 *
1435 * @param callback Callback to be informed about the result.
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001436 */
Jorim Jaggi241ae102016-11-02 21:57:33 -07001437 public void dismissKeyguardLw(@Nullable IKeyguardDismissCallback callback);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001438
1439 /**
Jorim Jaggicff0acb2014-03-31 16:35:15 +02001440 * Ask the policy whether the Keyguard has drawn. If the Keyguard is disabled, this method
1441 * returns true as soon as we know that Keyguard is disabled.
1442 *
1443 * @return true if the keyguard has drawn.
1444 */
1445 public boolean isKeyguardDrawnLw();
1446
Jorim Jaggi77e10432016-10-26 17:43:56 -07001447 public boolean isShowingDreamLw();
1448
Jorim Jaggicff0acb2014-03-31 16:35:15 +02001449 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -07001450 * Given an orientation constant, returns the appropriate surface rotation,
1451 * taking into account sensors, docking mode, rotation lock, and other factors.
1452 *
1453 * @param orientation An orientation constant, such as
1454 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
1455 * @param lastRotation The most recently used rotation.
1456 * @return The surface rotation to use.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001457 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001458 public int rotationForOrientationLw(@ActivityInfo.ScreenOrientation int orientation,
1459 int lastRotation);
Jeff Brown01a98dd2011-09-20 15:08:29 -07001460
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001461 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -07001462 * Given an orientation constant and a rotation, returns true if the rotation
1463 * has compatible metrics to the requested orientation. For example, if
1464 * the application requested landscape and got seascape, then the rotation
1465 * has compatible metrics; if the application requested portrait and got landscape,
1466 * then the rotation has incompatible metrics; if the application did not specify
1467 * a preference, then anything goes.
1468 *
1469 * @param orientation An orientation constant, such as
1470 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
1471 * @param rotation The rotation to check.
1472 * @return True if the rotation is compatible with the requested orientation.
Dianne Hackborndacea8c2011-04-21 17:26:39 -07001473 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001474 public boolean rotationHasCompatibleMetricsLw(@ActivityInfo.ScreenOrientation int orientation,
1475 int rotation);
Dianne Hackborndacea8c2011-04-21 17:26:39 -07001476
1477 /**
Jeff Brownc0347aa2011-09-23 17:26:09 -07001478 * Called by the window manager when the rotation changes.
1479 *
1480 * @param rotation The new rotation.
1481 */
1482 public void setRotationLw(int rotation);
1483
1484 /**
Jeff Brownac143512012-04-05 18:57:33 -07001485 * Called when the system is mostly done booting to set whether
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001486 * the system should go into safe mode.
1487 */
Jeff Brownac143512012-04-05 18:57:33 -07001488 public void setSafeMode(boolean safeMode);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001489
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001490 /**
1491 * Called when the system is mostly done booting.
1492 */
1493 public void systemReady();
1494
1495 /**
Dianne Hackbornba24e4d2011-09-01 11:17:06 -07001496 * Called when the system is done booting to the point where the
1497 * user can start interacting with it.
1498 */
1499 public void systemBooted();
1500
1501 /**
Dianne Hackborn661cd522011-08-22 00:26:20 -07001502 * Show boot time message to the user.
1503 */
1504 public void showBootMessage(final CharSequence msg, final boolean always);
1505
1506 /**
1507 * Hide the UI for showing boot messages, never to be displayed again.
1508 */
1509 public void hideBootMessages();
1510
1511 /**
Mike Lockwoodef731622010-01-27 17:51:34 -05001512 * Called when userActivity is signalled in the power manager.
1513 * This is safe to call from any thread, with any window manager locks held or not.
1514 */
1515 public void userActivity();
1516
1517 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001518 * Called when we have finished booting and can now display the home
Jeff Brownc042ee22012-05-08 13:03:42 -07001519 * screen to the user. This will happen after systemReady(), and at
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001520 * this point the display is active.
1521 */
1522 public void enableScreenAfterBoot();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001523
Tor Norbyed9273d62013-05-30 15:59:53 -07001524 public void setCurrentOrientationLw(@ActivityInfo.ScreenOrientation int newOrientation);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001525
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001526 /**
1527 * Call from application to perform haptic feedback on its window.
1528 */
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -07001529 public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001531 /**
Daniel Sandler0601eb72011-04-13 01:01:32 -04001532 * Called when we have started keeping the screen on because a window
1533 * requesting this has become visible.
1534 */
Jeff Brownc38c9be2012-10-04 13:16:19 -07001535 public void keepScreenOnStartedLw();
Daniel Sandler0601eb72011-04-13 01:01:32 -04001536
1537 /**
1538 * Called when we have stopped keeping the screen on because the last window
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001539 * requesting this is no longer visible.
1540 */
Jeff Brownc38c9be2012-10-04 13:16:19 -07001541 public void keepScreenOnStoppedLw();
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001542
1543 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001544 * Gets the current user rotation mode.
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001545 *
1546 * @return The rotation mode.
1547 *
1548 * @see WindowManagerPolicy#USER_ROTATION_LOCKED
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001549 * @see WindowManagerPolicy#USER_ROTATION_FREE
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001550 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001551 @UserRotationMode
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001552 public int getUserRotationMode();
1553
1554 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001555 * Inform the policy that the user has chosen a preferred orientation ("rotation lock").
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001556 *
1557 * @param mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001558 * {@link WindowManagerPolicy#USER_ROTATION_FREE}.
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001559 * @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90},
Craig Mautner69b08182012-09-05 13:07:13 -07001560 * {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}.
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001561 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001562 public void setUserRotationMode(@UserRotationMode int mode, @Surface.Rotation int rotation);
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001563
1564 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -07001565 * Called when a new system UI visibility is being reported, allowing
1566 * the policy to adjust what is actually reported.
Tor Norbyed9273d62013-05-30 15:59:53 -07001567 * @param visibility The raw visibility reported by the status bar.
Dianne Hackborndf89e652011-10-06 22:35:11 -07001568 * @return The new desired visibility.
1569 */
1570 public int adjustSystemUiVisibilityLw(int visibility);
1571
1572 /**
Winsonab216602016-08-09 14:05:20 -07001573 * Called by System UI to notify of changes to the visibility of Recents.
1574 */
1575 public void setRecentsVisibilityLw(boolean visible);
1576
1577 /**
1578 * Called by System UI to notify of changes to the visibility of PIP.
1579 */
Winson Chungac52f282017-03-30 14:44:52 -07001580 void setPipVisibilityLw(boolean visible);
Winsonab216602016-08-09 14:05:20 -07001581
1582 /**
Daniel Sandler0c4ccff2011-10-19 16:39:14 -04001583 * Specifies whether there is an on-screen navigation bar separate from the status bar.
1584 */
1585 public boolean hasNavigationBar();
1586
1587 /**
Jim Miller93c518e2012-01-17 15:55:31 -08001588 * Lock the device now.
1589 */
Adam Cohenf7522022012-10-03 20:03:18 -07001590 public void lockNow(Bundle options);
Jim Miller93c518e2012-01-17 15:55:31 -08001591
1592 /**
satok1bc0a492012-04-25 22:47:12 +09001593 * Set the last used input method window state. This state is used to make IME transition
1594 * smooth.
1595 * @hide
1596 */
1597 public void setLastInputMethodWindowLw(WindowState ime, WindowState target);
1598
1599 /**
Yohei Yukawad6475a62017-04-17 10:35:27 -07001600 * An internal callback (from InputMethodManagerService) to notify a state change regarding
1601 * whether the back key should dismiss the software keyboard (IME) or not.
1602 *
1603 * @param newValue {@code true} if the software keyboard is shown and the back key is expected
1604 * to dismiss the software keyboard.
1605 * @hide
1606 */
1607 default void setDismissImeOnBackKeyPressed(boolean newValue) {
1608 // Default implementation does nothing.
1609 }
1610
1611 /**
Craig Mautner84984fa2014-06-19 11:19:20 -07001612 * Show the recents task list app.
1613 * @hide
1614 */
Jorim Jaggi681fc7b2016-04-14 22:02:39 -07001615 public void showRecentApps(boolean fromHome);
Craig Mautner84984fa2014-06-19 11:19:20 -07001616
1617 /**
Alan Viverettee34560b22014-07-10 14:50:06 -07001618 * Show the global actions dialog.
1619 * @hide
1620 */
1621 public void showGlobalActions();
1622
1623 /**
Satoshi Kataoka658c7b82013-10-10 17:03:51 +09001624 * @return The current height of the input method window.
1625 */
1626 public int getInputMethodWindowVisibleHeightLw();
1627
1628 /**
Craig Mautnerf1b67412012-09-19 13:18:29 -07001629 * Called when the current user changes. Guaranteed to be called before the broadcast
1630 * of the new user id is made to all listeners.
1631 *
1632 * @param newUserId The id of the incoming user.
1633 */
1634 public void setCurrentUserLw(int newUserId);
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001635
1636 /**
Evan Rosky18396452016-07-27 15:19:37 -07001637 * For a given user-switch operation, this will be called once with switching=true before the
1638 * user-switch and once with switching=false afterwards (or if the user-switch was cancelled).
1639 * This gives the policy a chance to alter its behavior for the duration of a user-switch.
1640 *
1641 * @param switching true if a user-switch is in progress
1642 */
1643 void setSwitchingUser(boolean switching);
1644
1645 /**
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001646 * Print the WindowManagerPolicy's state into the given stream.
1647 *
1648 * @param prefix Text to print at the front of each line.
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001649 * @param writer The PrintWriter to which you should dump your state. This will be
1650 * closed for you after you return.
1651 * @param args additional arguments to the dump request.
1652 */
Jeff Brownd7a04de2012-06-17 14:17:52 -07001653 public void dump(String prefix, PrintWriter writer, String[] args);
Jim Miller4eeb4f62012-11-08 00:04:29 -08001654
1655 /**
Svetoslav Ganov545252f2012-12-10 18:29:24 -08001656 * Returns whether a given window type can be magnified.
1657 *
1658 * @param windowType The window type.
1659 * @return True if the window can be magnified.
1660 */
1661 public boolean canMagnifyWindow(int windowType);
1662
1663 /**
1664 * Returns whether a given window type is considered a top level one.
1665 * A top level window does not have a container, i.e. attached window,
1666 * or if it has a container it is laid out as a top-level window, not
1667 * as a child of its container.
1668 *
1669 * @param windowType The window type.
1670 * @return True if the window is a top level one.
1671 */
1672 public boolean isTopLevelWindow(int windowType);
Jorim Jaggi0d674622014-05-21 01:34:15 +02001673
1674 /**
1675 * Notifies the keyguard to start fading out.
Jorim Jaggie29b2db2014-05-30 23:17:03 +02001676 *
1677 * @param startTime the start time of the animation in uptime milliseconds
1678 * @param fadeoutDuration the duration of the exit animation, in milliseconds
Jorim Jaggi0d674622014-05-21 01:34:15 +02001679 */
Jorim Jaggie29b2db2014-05-30 23:17:03 +02001680 public void startKeyguardExitAnimation(long startTime, long fadeoutDuration);
Jorim Jaggi737af722015-12-31 10:42:27 +01001681
1682 /**
1683 * Calculates the stable insets without running a layout.
1684 *
1685 * @param displayRotation the current display rotation
Jorim Jaggi737af722015-12-31 10:42:27 +01001686 * @param displayWidth the current display width
1687 * @param displayHeight the current display height
Winson3e874742016-01-07 10:08:17 -08001688 * @param outInsets the insets to return
Jorim Jaggi737af722015-12-31 10:42:27 +01001689 */
1690 public void getStableInsetsLw(int displayRotation, int displayWidth, int displayHeight,
1691 Rect outInsets);
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001692
Jorim Jaggi0ffd49c2016-02-12 15:04:21 -08001693
1694 /**
1695 * @return true if the navigation bar is forced to stay visible
1696 */
1697 public boolean isNavBarForcedShownLw(WindowState win);
1698
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001699 /**
Andrii Kulian3a1619d2017-07-07 14:38:09 -07001700 * @return The side of the screen where navigation bar is positioned.
1701 * @see #NAV_BAR_LEFT
1702 * @see #NAV_BAR_RIGHT
1703 * @see #NAV_BAR_BOTTOM
1704 */
1705 int getNavBarPosition();
1706
1707 /**
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001708 * Calculates the insets for the areas that could never be removed in Honeycomb, i.e. system
1709 * bar or button bar. See {@link #getNonDecorDisplayWidth}.
1710 *
1711 * @param displayRotation the current display rotation
1712 * @param displayWidth the current display width
1713 * @param displayHeight the current display height
1714 * @param outInsets the insets to return
1715 */
1716 public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight,
1717 Rect outInsets);
Jorim Jaggi5060bd82016-02-19 17:12:19 -08001718
1719 /**
1720 * @return True if a specified {@param dockSide} is allowed on the current device, or false
1721 * otherwise. It is guaranteed that at least one dock side for a particular orientation
1722 * is allowed, so for example, if DOCKED_RIGHT is not allowed, DOCKED_LEFT is allowed.
1723 */
1724 public boolean isDockSideAllowed(int dockSide);
Jorim Jaggi11c62e12016-04-05 20:41:21 -07001725
1726 /**
1727 * Called when the configuration has changed, and it's safe to load new values from resources.
1728 */
1729 public void onConfigurationChanged();
Robert Carr6da3cc02016-06-16 15:17:07 -07001730
1731 public boolean shouldRotateSeamlessly(int oldRotation, int newRotation);
Keun-young Park4136d2d2017-05-08 14:51:59 -07001732
1733 /**
1734 * Called when System UI has been started.
1735 */
1736 void onSystemUiStarted();
1737
1738 /**
1739 * Checks whether the policy is ready for dismissing the boot animation and completing the boot.
1740 *
1741 * @return true if ready; false otherwise.
1742 */
1743 boolean canDismissBootAnimation();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001744}