blob: 66506a18296b76bae2d448ca38ecdb2106c23d02 [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;
Steven Timotiusaf03df62017-07-18 16:56:43 -070081import android.util.proto.ProtoOutputStream;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082import android.view.animation.Animation;
Aurimas Liutikas67e2ae82016-10-11 18:17:42 -070083
Jorim Jaggi241ae102016-11-02 21:57:33 -070084import com.android.internal.policy.IKeyguardDismissCallback;
Muyuan Li94ce94e2016-02-24 16:20:54 -080085import com.android.internal.policy.IShortcutService;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086
Dianne Hackbornf99f9c52011-01-12 15:49:25 -080087import java.io.PrintWriter;
Tor Norbyed9273d62013-05-30 15:59:53 -070088import java.lang.annotation.Retention;
89import java.lang.annotation.RetentionPolicy;
Dianne Hackbornf99f9c52011-01-12 15:49:25 -080090
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091/**
92 * This interface supplies all UI-specific behavior of the window manager. An
93 * instance of it is created by the window manager when it starts up, and allows
94 * customization of window layering, special window types, key dispatching, and
95 * layout.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -070096 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 * <p>Because this provides deep interaction with the system window manager,
98 * specific methods on this interface can be called from a variety of contexts
99 * with various restrictions on what they can do. These are encoded through
100 * a suffixes at the end of a method encoding the thread the method is called
101 * from and any locks that are held when it is being called; if no suffix
102 * is attached to a method, then it is not called with any locks and may be
103 * called from the main window manager thread or another thread calling into
104 * the window manager.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700105 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106 * <p>The current suffixes are:
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700107 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 * <dl>
109 * <dt> Ti <dd> Called from the input thread. This is the thread that
110 * collects pending input events and dispatches them to the appropriate window.
111 * It may block waiting for events to be processed, so that the input stream is
112 * properly serialized.
113 * <dt> Tq <dd> Called from the low-level input queue thread. This is the
114 * thread that reads events out of the raw input devices and places them
115 * into the global input queue that is read by the <var>Ti</var> thread.
116 * This thread should not block for a long period of time on anything but the
117 * key driver.
118 * <dt> Lw <dd> Called with the main window manager lock held. Because the
119 * window manager is a very low-level system service, there are few other
120 * system services you can call with this lock held. It is explicitly okay to
121 * make calls into the package manager and power manager; it is explicitly not
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -0700122 * okay to make calls into the activity manager or most other services. Note that
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800123 * {@link android.content.Context#checkPermission(String, int, int)} and
124 * variations require calling into the activity manager.
125 * <dt> Li <dd> Called with the input thread lock held. This lock can be
126 * acquired by the window manager while it holds the window lock, so this is
127 * even more restrictive than <var>Lw</var>.
128 * </dl>
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700129 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 * @hide
131 */
132public interface WindowManagerPolicy {
Jeff Brownb6997262010-10-08 22:31:17 -0700133 // Policy flags. These flags are also defined in frameworks/base/include/ui/Input.h.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 public final static int FLAG_WAKE = 0x00000001;
Michael Wright337d9d22014-04-22 15:03:48 -0700135 public final static int FLAG_VIRTUAL = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136
Jeff Brown85a31762010-09-01 17:01:00 -0700137 public final static int FLAG_INJECTED = 0x01000000;
Jeff Browne20c9e02010-10-11 14:20:19 -0700138 public final static int FLAG_TRUSTED = 0x02000000;
Jeff Brown0029c662011-03-30 02:25:18 -0700139 public final static int FLAG_FILTERED = 0x04000000;
140 public final static int FLAG_DISABLE_KEY_REPEAT = 0x08000000;
Jeff Brown85a31762010-09-01 17:01:00 -0700141
Jeff Brown037c33e2014-04-09 00:31:55 -0700142 public final static int FLAG_INTERACTIVE = 0x20000000;
Jeff Brownb6997262010-10-08 22:31:17 -0700143 public final static int FLAG_PASS_TO_USER = 0x40000000;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144
Adrian Roosd5c2db62016-03-08 16:11:31 -0800145 // Flags for IActivityManager.keyguardGoingAway()
146 public final static int KEYGUARD_GOING_AWAY_FLAG_TO_SHADE = 1 << 0;
147 public final static int KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS = 1 << 1;
148 public final static int KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER = 1 << 2;
149
Jeff Browndaa37532012-05-01 15:54:03 -0700150 // Flags used for indicating whether the internal and/or external input devices
151 // of some type are available.
152 public final static int PRESENCE_INTERNAL = 1 << 0;
153 public final static int PRESENCE_EXTERNAL = 1 << 1;
154
Andrii Kulian3a1619d2017-07-07 14:38:09 -0700155 // Navigation bar position values
156 int NAV_BAR_LEFT = 1 << 0;
157 int NAV_BAR_RIGHT = 1 << 1;
158 int NAV_BAR_BOTTOM = 1 << 2;
159
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800160 public final static boolean WATCH_POINTER = false;
161
Dianne Hackbornad7fa7f2011-01-07 14:06:50 -0800162 /**
163 * Sticky broadcast of the current HDMI plugged state.
164 */
165 public final static String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED";
166
167 /**
168 * Extra in {@link #ACTION_HDMI_PLUGGED} indicating the state: true if
169 * plugged in to HDMI, false if not.
170 */
171 public final static String EXTRA_HDMI_PLUGGED_STATE = "state";
172
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800173 /**
Bryce Lee01b0c5f2015-02-05 18:24:04 -0800174 * Set to {@code true} when intent was invoked from pressing the home key.
175 * @hide
176 */
177 @SystemApi
178 public static final String EXTRA_FROM_HOME_KEY = "android.intent.extra.FROM_HOME_KEY";
179
180 /**
Jeff Brownd5bb82d2011-10-12 13:57:59 -0700181 * Pass this event to the user / app. To be returned from
182 * {@link #interceptKeyBeforeQueueing}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800183 */
184 public final static int ACTION_PASS_TO_USER = 0x00000001;
185
186 /**
Muyuan Li94ce94e2016-02-24 16:20:54 -0800187 * Register shortcuts for window manager to dispatch.
188 * Shortcut code is packed as (metaState << Integer.SIZE) | keyCode
189 * @hide
190 */
191 void registerShortcutKey(long shortcutCode, IShortcutService shortcutKeyReceiver)
192 throws RemoteException;
193
194 /**
Jorim Jaggife762342016-10-13 14:33:27 +0200195 * Called when the Keyguard occluded state changed.
196 * @param occluded Whether Keyguard is currently occluded or not.
Adrian Roosd88eb262016-08-04 14:50:48 -0700197 */
Jorim Jaggife762342016-10-13 14:33:27 +0200198 void onKeyguardOccludedChangedLw(boolean occluded);
Adrian Roosd88eb262016-08-04 14:50:48 -0700199
200 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800201 * Interface to the Window Manager state associated with a particular
202 * window. You can hold on to an instance of this interface from the call
203 * to prepareAddWindow() until removeWindow().
204 */
205 public interface WindowState {
206 /**
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800207 * Return the uid of the app that owns this window.
208 */
209 int getOwningUid();
210
211 /**
212 * Return the package name of the app that owns this window.
213 */
214 String getOwningPackage();
215
216 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800217 * Perform standard frame computation. The result can be obtained with
218 * getFrame() if so desired. Must be called with the window manager
219 * lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700220 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800221 * @param parentFrame The frame of the parent container this window
222 * is in, used for computing its basic position.
223 * @param displayFrame The frame of the overall display in which this
224 * window can appear, used for constraining the overall dimensions
225 * of the window.
Dianne Hackbornc4aad012013-02-22 15:05:25 -0800226 * @param overlayFrame The frame within the display that is inside
227 * of the overlay region.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800228 * @param contentFrame The frame within the display in which we would
229 * like active content to appear. This will cause windows behind to
230 * be resized to match the given content frame.
231 * @param visibleFrame The frame within the display that the window
232 * is actually visible, used for computing its visible insets to be
233 * given to windows behind.
234 * This can be used as a hint for scrolling (avoiding resizing)
235 * the window to make certain that parts of its content
236 * are visible.
John Spurlock46646232013-09-30 22:32:42 -0400237 * @param decorFrame The decor frame specified by policy specific to this window,
238 * to use for proper cropping during animation.
Adrian Roosfa104232014-06-20 16:10:14 -0700239 * @param stableFrame The frame around which stable system decoration is positioned.
Filip Gruszczynski2217f612015-05-26 11:32:08 -0700240 * @param outsetFrame The frame that includes areas that aren't part of the surface but we
241 * want to treat them as such.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800242 */
243 public void computeFrameLw(Rect parentFrame, Rect displayFrame,
Adrian Roosfa104232014-06-20 16:10:14 -0700244 Rect overlayFrame, Rect contentFrame, Rect visibleFrame, Rect decorFrame,
Filip Gruszczynski2217f612015-05-26 11:32:08 -0700245 Rect stableFrame, Rect outsetFrame);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800246
247 /**
248 * Retrieve the current frame of the window that has been assigned by
249 * the window manager. Must be called with the window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700250 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800251 * @return Rect The rectangle holding the window frame.
252 */
253 public Rect getFrameLw();
254
255 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700256 * Retrieve the current position of the window that is actually shown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800257 * Must be called with the window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700258 *
259 * @return Point The point holding the shown window position.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800260 */
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700261 public Point getShownPositionLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800262
263 /**
264 * Retrieve the frame of the display that this window was last
265 * laid out in. Must be called with the
266 * window manager lock held.
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700267 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800268 * @return Rect The rectangle holding the display frame.
269 */
270 public Rect getDisplayFrameLw();
271
272 /**
Dianne Hackbornc4aad012013-02-22 15:05:25 -0800273 * Retrieve the frame of the area inside the overscan region of the
274 * display that this window was last laid out in. Must be called with the
275 * window manager lock held.
276 *
277 * @return Rect The rectangle holding the display overscan frame.
278 */
279 public Rect getOverscanFrameLw();
280
281 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800282 * Retrieve the frame of the content area that this window was last
283 * laid out in. This is the area in which the content of the window
284 * should be placed. It will be smaller than the display frame to
285 * account for screen decorations such as a status bar or soft
286 * keyboard. Must be called with the
287 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700288 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800289 * @return Rect The rectangle holding the content frame.
290 */
291 public Rect getContentFrameLw();
292
293 /**
294 * Retrieve the frame of the visible area that this window was last
295 * laid out in. This is the area of the screen in which the window
296 * will actually be fully visible. It will be smaller than the
297 * content frame to account for transient UI elements blocking it
298 * such as an input method's candidates UI. Must be called with the
299 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700300 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800301 * @return Rect The rectangle holding the visible frame.
302 */
303 public Rect getVisibleFrameLw();
304
305 /**
306 * Returns true if this window is waiting to receive its given
307 * internal insets from the client app, and so should not impact the
308 * layout of other windows.
309 */
310 public boolean getGivenInsetsPendingLw();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700311
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800312 /**
313 * Retrieve the insets given by this window's client for the content
314 * area of windows behind it. Must be called with the
315 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700316 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 * @return Rect The left, top, right, and bottom insets, relative
318 * to the window's frame, of the actual contents.
319 */
320 public Rect getGivenContentInsetsLw();
321
322 /**
323 * Retrieve the insets given by this window's client for the visible
324 * area of windows behind it. Must be called with the
325 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700326 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800327 * @return Rect The left, top, right, and bottom insets, relative
328 * to the window's frame, of the actual visible area.
329 */
330 public Rect getGivenVisibleInsetsLw();
331
332 /**
333 * Retrieve the current LayoutParams of the window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700334 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 * @return WindowManager.LayoutParams The window's internal LayoutParams
336 * instance.
337 */
338 public WindowManager.LayoutParams getAttrs();
339
340 /**
Dianne Hackborn73ab6a42011-12-13 11:16:23 -0800341 * Return whether this window needs the menu key shown. Must be called
342 * with window lock held, because it may need to traverse down through
343 * window list to determine the result.
344 * @param bottom The bottom-most window to consider when determining this.
345 */
346 public boolean getNeedsMenuLw(WindowState bottom);
347
348 /**
Dianne Hackborn9a230e02011-10-06 11:51:27 -0700349 * Retrieve the current system UI visibility flags associated with
350 * this window.
351 */
352 public int getSystemUiVisibility();
353
354 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800355 * Get the layer at which this window's surface will be Z-ordered.
356 */
357 public int getSurfaceLayer();
Selim Cinekd6623612015-05-22 18:56:22 -0700358
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800359 /**
Selim Cinekd6623612015-05-22 18:56:22 -0700360 * Retrieve the type of the top-level window.
361 *
362 * @return the base type of the parent window if attached or its own type otherwise
363 */
364 public int getBaseType();
365
366 /**
367 * Return the token for the application (actually activity) that owns
368 * this window. May return null for system windows.
369 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 * @return An IApplicationToken identifying the owning activity.
371 */
372 public IApplicationToken getAppToken();
373
374 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700375 * Return true if this window is participating in voice interaction.
376 */
377 public boolean isVoiceInteraction();
378
379 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700380 * Return true if, at any point, the application token associated with
381 * this window has actually displayed any windows. This is most useful
382 * with the "starting up" window to determine if any windows were
383 * displayed when it is closed.
384 *
385 * @return Returns true if one or more windows have been displayed,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 * else false.
387 */
388 public boolean hasAppShownWindows();
389
390 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800391 * Is this window visible? It is not visible if there is no
392 * surface, or we are in the process of running an exit animation
393 * that will remove the surface.
394 */
395 boolean isVisibleLw();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700396
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800397 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700398 * Is this window currently visible to the user on-screen? It is
399 * displayed either if it is visible or it is currently running an
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 * animation before no longer being visible. Must be called with the
401 * window manager lock held.
402 */
403 boolean isDisplayedLw();
404
405 /**
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700406 * Return true if this window (or a window it is attached to, but not
407 * considering its app token) is currently animating.
408 */
Filip Gruszczynski14b4e572015-11-03 15:53:55 -0800409 boolean isAnimatingLw();
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700410
411 /**
Jorim Jaggi23cc9aa2017-05-23 16:05:35 +0200412 * @return Whether the window can affect SystemUI flags, meaning that SystemUI (system bars,
413 * for example) will be affected by the flags specified in this window. This is the
414 * case when the surface is on screen but not exiting.
415 */
416 boolean canAffectSystemUiFlags();
417
418 /**
Dianne Hackborn01b02a72012-01-12 14:05:03 -0800419 * Is this window considered to be gone for purposes of layout?
420 */
421 boolean isGoneForLayoutLw();
422
423 /**
Adrian Roos76d2fe42015-07-09 14:54:08 -0700424 * Returns true if the window has a surface that it has drawn a
425 * complete UI in to. Note that this is different from {@link #hasDrawnLw()}
426 * in that it also returns true if the window is READY_TO_SHOW, but was not yet
427 * promoted to HAS_DRAWN.
428 */
429 boolean isDrawnLw();
430
431 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700432 * Returns true if this window has been shown on screen at some time in
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800433 * the past. Must be called with the window manager lock held.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800434 */
435 public boolean hasDrawnLw();
436
437 /**
438 * Can be called by the policy to force a window to be hidden,
439 * regardless of whether the client or window manager would like
440 * it shown. Must be called with the window manager lock held.
441 * Returns true if {@link #showLw} was last called for the window.
442 */
443 public boolean hideLw(boolean doAnimation);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700444
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800445 /**
446 * Can be called to undo the effect of {@link #hideLw}, allowing a
447 * window to be shown as long as the window manager and client would
448 * also like it to be shown. Must be called with the window manager
449 * lock held.
450 * Returns true if {@link #hideLw} was last called for the window.
451 */
452 public boolean showLw(boolean doAnimation);
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700453
454 /**
455 * Check whether the process hosting this window is currently alive.
456 */
457 public boolean isAlive();
Craig Mautner69b08182012-09-05 13:07:13 -0700458
459 /**
460 * Check if window is on {@link Display#DEFAULT_DISPLAY}.
461 * @return true if window is on default display.
462 */
463 public boolean isDefaultDisplay();
Adrian Rooscd3884d2015-02-18 17:25:23 +0100464
465 /**
466 * Check whether the window is currently dimming.
467 */
468 public boolean isDimming();
Jorim Jaggi86905582016-02-09 21:36:09 -0800469
470 /**
471 * @return the stack id this windows belongs to, or {@link StackId#INVALID_STACK_ID} if
472 * not attached to any stack.
473 */
474 int getStackId();
Wale Ogunwale9185fb02016-03-11 18:06:14 -0800475
476 /**
477 * Returns true if the window is current in multi-windowing mode. i.e. it shares the
478 * screen with other application windows.
479 */
Andrii Kulian933076d2016-03-29 17:04:42 -0700480 public boolean isInMultiWindowMode();
Robert Carrfd10cd12016-06-29 16:41:50 -0700481
482 public int getRotationAnimationHint();
Jorim Jaggife762342016-10-13 14:33:27 +0200483
484 public boolean isInputMethodWindow();
485
486 public int getDisplayId();
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800487
488 /**
489 * Returns true if the window owner can add internal system windows.
Jorim Jaggif12ec0f2017-08-23 16:14:10 +0200490 * That is, they have {@link permission#INTERNAL_SYSTEM_WINDOW}.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800491 */
492 default boolean canAddInternalSystemWindow() {
493 return false;
494 }
Jorim Jaggif12ec0f2017-08-23 16:14:10 +0200495
496 /**
497 * Returns true if the window owner has the permission to acquire a sleep token when it's
498 * visible. That is, they have the permission {@link permission#DEVICE_POWER}.
499 */
500 boolean canAcquireSleepToken();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800501 }
502
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700503 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700504 * Representation of a input consumer that the policy has added to the
505 * window manager to consume input events going to windows below it.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700506 */
Selim Cinekf83e8242015-05-19 18:08:14 -0700507 public interface InputConsumer {
Dianne Hackborndf89e652011-10-06 22:35:11 -0700508 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700509 * Remove the input consumer from the window manager.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700510 */
511 void dismiss();
512 }
513
514 /**
Jorim Jaggiba41f4b2016-12-14 17:43:07 -0800515 * Holds the contents of a starting window. {@link #addSplashScreen} needs to wrap the
516 * contents of the starting window into an class implementing this interface, which then will be
Jorim Jaggi02886a82016-12-06 09:10:06 -0800517 * held by WM and released with {@link #remove} when no longer needed.
Jorim Jaggiba41f4b2016-12-14 17:43:07 -0800518 */
519 interface StartingSurface {
Jorim Jaggi02886a82016-12-06 09:10:06 -0800520
521 /**
522 * Removes the starting window surface. Do not hold the window manager lock when calling
523 * this method!
524 */
525 void remove();
Jorim Jaggiba41f4b2016-12-14 17:43:07 -0800526 }
527
528 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700529 * Interface for calling back in to the window manager that is private
530 * between it and the policy.
531 */
532 public interface WindowManagerFuncs {
Jeff Brownac143512012-04-05 18:57:33 -0700533 public static final int LID_ABSENT = -1;
534 public static final int LID_CLOSED = 0;
535 public static final int LID_OPEN = 1;
536
Michael Wright3818c922014-09-02 13:59:07 -0700537 public static final int CAMERA_LENS_COVER_ABSENT = -1;
538 public static final int CAMERA_LENS_UNCOVERED = 0;
539 public static final int CAMERA_LENS_COVERED = 1;
540
Dianne Hackborndf89e652011-10-06 22:35:11 -0700541 /**
542 * Ask the window manager to re-evaluate the system UI flags.
543 */
544 public void reevaluateStatusBarVisibility();
545
546 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700547 * Add a input consumer which will consume all input events going to any window below it.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700548 */
Winson41275482016-10-10 15:17:45 -0700549 public InputConsumer createInputConsumer(Looper looper, String name,
Selim Cinekf83e8242015-05-19 18:08:14 -0700550 InputEventReceiver.Factory inputEventReceiverFactory);
Jeff Brownac143512012-04-05 18:57:33 -0700551
552 /**
553 * Returns a code that describes the current state of the lid switch.
554 */
555 public int getLidState();
556
557 /**
Edward Savage-Jones7def60d2015-11-13 13:27:03 +0100558 * Lock the device now.
559 */
560 public void lockDeviceNow();
561
562 /**
Michael Wright3818c922014-09-02 13:59:07 -0700563 * Returns a code that descripbes whether the camera lens is covered or not.
564 */
565 public int getCameraLensCoverState();
566
567 /**
Yohei Yukawaae61f712015-12-09 13:00:10 -0800568 * Switch the input method, to be precise, input method subtype.
569 *
570 * @param forwardDirection {@code true} to rotate in a forward direction.
571 */
572 public void switchInputMethod(boolean forwardDirection);
573
Jeff Brown9a538ee2012-08-20 14:56:57 -0700574 public void shutdown(boolean confirm);
Alison Cichowlasf8eca402016-08-05 14:50:27 -0400575 public void reboot(boolean confirm);
Jeff Brown9a538ee2012-08-20 14:56:57 -0700576 public void rebootSafeMode(boolean confirm);
John Spurlock04db1762013-05-13 12:46:41 -0400577
578 /**
579 * Return the window manager lock needed to correctly call "Lw" methods.
580 */
581 public Object getWindowManagerLock();
Craig Mautner037aa8d2013-06-07 10:35:44 -0700582
583 /** Register a system listener for touch events */
584 void registerPointerEventListener(PointerEventListener listener);
585
586 /** Unregister a system listener for touch events */
587 void unregisterPointerEventListener(PointerEventListener listener);
Jorim Jaggi81ba11e2016-02-03 22:04:22 -0800588
589 /**
590 * @return The content insets of the docked divider window.
591 */
592 int getDockedDividerInsetsLw();
Jorim Jaggi86905582016-02-09 21:36:09 -0800593
594 /**
595 * Retrieves the {@param outBounds} from the stack with id {@param stackId}.
596 */
597 void getStackBounds(int stackId, Rect outBounds);
Jorim Jaggi77e10432016-10-26 17:43:56 -0700598
599 /**
600 * Notifies window manager that {@link #isShowingDreamLw} has changed.
601 */
602 void notifyShowingDreamChanged();
Jorim Jaggie69c9312016-10-31 18:24:38 -0700603
604 /**
Jorim Jaggi40db0292016-06-27 17:58:03 -0700605 * @return The currently active input method window.
606 */
607 WindowState getInputMethodWindowLw();
608
609 /**
Jorim Jaggie69c9312016-10-31 18:24:38 -0700610 * Notifies window manager that {@link #isKeyguardTrustedLw} has changed.
611 */
612 void notifyKeyguardTrustedChanged();
Jorim Jaggi51304d72017-05-17 17:25:32 +0200613
614 /**
615 * Notifies the window manager that screen is being turned off.
616 *
617 * @param listener callback to call when display can be turned off
618 */
619 void screenTurningOff(ScreenOffListener listener);
Craig Mautner037aa8d2013-06-07 10:35:44 -0700620 }
621
622 public interface PointerEventListener {
623 /**
624 * 1. onPointerEvent will be called on the service.UiThread.
625 * 2. motionEvent will be recycled after onPointerEvent returns so if it is needed later a
626 * copy() must be made and the copy must be recycled.
627 **/
Tarandeep Singhe1cfcf42017-07-10 18:50:00 -0700628 void onPointerEvent(MotionEvent motionEvent);
629
630 /**
631 * @see #onPointerEvent(MotionEvent)
632 **/
633 default void onPointerEvent(MotionEvent motionEvent, int displayId) {
634 if (displayId == DEFAULT_DISPLAY) {
635 onPointerEvent(motionEvent);
636 }
637 }
Dianne Hackborndf89e652011-10-06 22:35:11 -0700638 }
639
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 /** Window has been added to the screen. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800641 public static final int TRANSIT_ENTER = 1;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 /** Window has been removed from the screen. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800643 public static final int TRANSIT_EXIT = 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800644 /** Window has been made visible. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800645 public static final int TRANSIT_SHOW = 3;
646 /** Window has been made invisible.
647 * TODO: Consider removal as this is unused. */
648 public static final int TRANSIT_HIDE = 4;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800649 /** The "application starting" preview window is no longer needed, and will
650 * animate away to show the real window. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800651 public static final int TRANSIT_PREVIEW_DONE = 5;
652
Dianne Hackborn254cb442010-01-27 19:23:59 -0800653 // NOTE: screen off reasons are in order of significance, with more
654 // important ones lower than less important ones.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700655
Dianne Hackborn254cb442010-01-27 19:23:59 -0800656 /** Screen turned off because of a device admin */
657 public final int OFF_BECAUSE_OF_ADMIN = 1;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800658 /** Screen turned off because of power button */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800659 public final int OFF_BECAUSE_OF_USER = 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800660 /** Screen turned off because of timeout */
Dianne Hackborn254cb442010-01-27 19:23:59 -0800661 public final int OFF_BECAUSE_OF_TIMEOUT = 3;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800662
Tor Norbyed9273d62013-05-30 15:59:53 -0700663 /** @hide */
664 @IntDef({USER_ROTATION_FREE, USER_ROTATION_LOCKED})
665 @Retention(RetentionPolicy.SOURCE)
666 public @interface UserRotationMode {}
667
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400668 /** When not otherwise specified by the activity's screenOrientation, rotation should be
669 * determined by the system (that is, using sensors). */
670 public final int USER_ROTATION_FREE = 0;
671 /** When not otherwise specified by the activity's screenOrientation, rotation is set by
672 * the user. */
673 public final int USER_ROTATION_LOCKED = 1;
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700674
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 /**
676 * Perform initialization of the policy.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700677 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 * @param context The system context we are running in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800679 */
680 public void init(Context context, IWindowManager windowManager,
Jeff Brown96307042012-07-27 15:51:34 -0700681 WindowManagerFuncs windowManagerFuncs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800682
683 /**
Craig Mautner46ac6fa2013-08-01 10:06:34 -0700684 * @return true if com.android.internal.R.bool#config_forceDefaultOrientation is true.
685 */
686 public boolean isDefaultOrientationForced();
687
688 /**
Dianne Hackborn9d132642011-04-21 17:26:39 -0700689 * Called by window manager once it has the initial, default native
690 * display dimensions.
691 */
Dianne Hackborndde331c2012-08-03 14:01:57 -0700692 public void setInitialDisplaySize(Display display, int width, int height, int density);
Dianne Hackborndacea8c2011-04-21 17:26:39 -0700693
Dianne Hackborn9d132642011-04-21 17:26:39 -0700694 /**
Dianne Hackbornc652de82013-02-15 16:32:56 -0800695 * Called by window manager to set the overscan region that should be used for the
696 * given display.
697 */
698 public void setDisplayOverscan(Display display, int left, int top, int right, int bottom);
699
700 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 * Check permissions when adding a window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700702 *
Dianne Hackbornc2293022013-02-06 23:14:49 -0800703 * @param attrs The window's LayoutParams.
704 * @param outAppOp First element will be filled with the app op corresponding to
705 * this window, or OP_NONE.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700706 *
Jeff Brown98365d72012-08-19 20:30:52 -0700707 * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800708 * else an error code, usually
Jeff Brown98365d72012-08-19 20:30:52 -0700709 * {@link WindowManagerGlobal#ADD_PERMISSION_DENIED}, to abort the add.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 */
Dianne Hackbornc2293022013-02-06 23:14:49 -0800711 public int checkAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800712
713 /**
Craig Mautner88400d32012-09-30 12:35:45 -0700714 * Check permissions when adding a window.
715 *
716 * @param attrs The window's LayoutParams.
717 *
718 * @return True if the window may only be shown to the current user, false if the window can
719 * be shown on all users' windows.
720 */
721 public boolean checkShowToOwnerOnly(WindowManager.LayoutParams attrs);
722
723 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800724 * Sanitize the layout parameters coming from a client. Allows the policy
725 * to do things like ensure that windows of a specific type can't take
726 * input focus.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700727 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 * @param attrs The window layout parameters to be modified. These values
729 * are modified in-place.
730 */
731 public void adjustWindowParamsLw(WindowManager.LayoutParams attrs);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700732
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800733 /**
734 * After the window manager has computed the current configuration based
735 * on its knowledge of the display and input devices, it gives the policy
736 * a chance to adjust the information contained in it. If you want to
737 * leave it as-is, simply do nothing.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700738 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800739 * <p>This method may be called by any thread in the window manager, but
740 * no internal locks in the window manager will be held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700741 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800742 * @param config The Configuration being computed, for you to change as
743 * desired.
Jeff Browndaa37532012-05-01 15:54:03 -0700744 * @param keyboardPresence Flags that indicate whether internal or external
745 * keyboards are present.
746 * @param navigationPresence Flags that indicate whether internal or external
747 * navigation devices are present.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800748 */
Jeff Browndaa37532012-05-01 15:54:03 -0700749 public void adjustConfigurationLw(Configuration config, int keyboardPresence,
750 int navigationPresence);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700751
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800752 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800753 * Returns the layer assignment for the window state. Allows you to control how different
754 * kinds of windows are ordered on-screen.
755 *
756 * @param win The window state
757 * @return int An arbitrary integer used to order windows, with lower numbers below higher ones.
758 */
759 default int getWindowLayerLw(WindowState win) {
760 return getWindowLayerFromTypeLw(win.getBaseType(), win.canAddInternalSystemWindow());
761 }
762
763 /**
764 * Returns the layer assignment for the window type. Allows you to control how different
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800765 * kinds of windows are ordered on-screen.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700766 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800767 * @param type The type of window being assigned.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800768 * @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 -0800769 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800770 default int getWindowLayerFromTypeLw(int type) {
771 if (isSystemAlertWindowType(type)) {
772 throw new IllegalArgumentException("Use getWindowLayerFromTypeLw() or"
773 + " getWindowLayerLw() for alert window types");
774 }
775 return getWindowLayerFromTypeLw(type, false /* canAddInternalSystemWindow */);
776 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800777
778 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800779 * Returns the layer assignment for the window type. Allows you to control how different
780 * kinds of windows are ordered on-screen.
781 *
782 * @param type The type of window being assigned.
783 * @param canAddInternalSystemWindow If the owner window associated with the type we are
784 * evaluating can add internal system windows. I.e they have
Jorim Jaggif12ec0f2017-08-23 16:14:10 +0200785 * {@link permission#INTERNAL_SYSTEM_WINDOW}. If true, alert window
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800786 * types {@link android.view.WindowManager.LayoutParams#isSystemAlertWindowType(int)}
787 * can be assigned layers greater than the layer for
788 * {@link android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY} Else, their
789 * layers would be lesser.
790 * @return int An arbitrary integer used to order windows, with lower numbers below higher ones.
791 */
792 default int getWindowLayerFromTypeLw(int type, boolean canAddInternalSystemWindow) {
793 if (type >= FIRST_APPLICATION_WINDOW && type <= LAST_APPLICATION_WINDOW) {
794 return APPLICATION_LAYER;
795 }
796
797 switch (type) {
798 case TYPE_WALLPAPER:
799 // wallpaper is at the bottom, though the window manager may move it.
800 return 1;
801 case TYPE_PRESENTATION:
802 case TYPE_PRIVATE_PRESENTATION:
803 return APPLICATION_LAYER;
804 case TYPE_DOCK_DIVIDER:
805 return APPLICATION_LAYER;
806 case TYPE_QS_DIALOG:
807 return APPLICATION_LAYER;
808 case TYPE_PHONE:
809 return 3;
810 case TYPE_SEARCH_BAR:
811 case TYPE_VOICE_INTERACTION_STARTING:
812 return 4;
813 case TYPE_VOICE_INTERACTION:
814 // voice interaction layer is almost immediately above apps.
815 return 5;
816 case TYPE_INPUT_CONSUMER:
817 return 6;
818 case TYPE_SYSTEM_DIALOG:
819 return 7;
820 case TYPE_TOAST:
821 // toasts and the plugged-in battery thing
822 return 8;
823 case TYPE_PRIORITY_PHONE:
824 // SIM errors and unlock. Not sure if this really should be in a high layer.
825 return 9;
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800826 case TYPE_SYSTEM_ALERT:
827 // like the ANR / app crashed dialogs
828 return canAddInternalSystemWindow ? 11 : 10;
829 case TYPE_APPLICATION_OVERLAY:
Wale Ogunwaled993a572017-02-05 13:52:09 -0800830 return 12;
831 case TYPE_DREAM:
832 // used for Dreams (screensavers with TYPE_DREAM windows)
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800833 return 13;
834 case TYPE_INPUT_METHOD:
835 // on-screen keyboards and other such input method user interfaces go here.
836 return 14;
837 case TYPE_INPUT_METHOD_DIALOG:
838 // on-screen keyboards and other such input method user interfaces go here.
839 return 15;
840 case TYPE_STATUS_BAR_SUB_PANEL:
841 return 17;
842 case TYPE_STATUS_BAR:
843 return 18;
844 case TYPE_STATUS_BAR_PANEL:
845 return 19;
846 case TYPE_KEYGUARD_DIALOG:
847 return 20;
848 case TYPE_VOLUME_OVERLAY:
849 // the on-screen volume indicator and controller shown when the user
850 // changes the device volume
851 return 21;
852 case TYPE_SYSTEM_OVERLAY:
853 // the on-screen volume indicator and controller shown when the user
854 // changes the device volume
855 return canAddInternalSystemWindow ? 22 : 11;
856 case TYPE_NAVIGATION_BAR:
857 // the navigation bar, if available, shows atop most things
858 return 23;
859 case TYPE_NAVIGATION_BAR_PANEL:
860 // some panels (e.g. search) need to show on top of the navigation bar
861 return 24;
862 case TYPE_SCREENSHOT:
863 // screenshot selection layer shouldn't go above system error, but it should cover
864 // navigation bars at the very least.
865 return 25;
866 case TYPE_SYSTEM_ERROR:
867 // system-level error dialogs
868 return canAddInternalSystemWindow ? 26 : 10;
869 case TYPE_MAGNIFICATION_OVERLAY:
870 // used to highlight the magnified portion of a display
871 return 27;
872 case TYPE_DISPLAY_OVERLAY:
873 // used to simulate secondary display devices
874 return 28;
875 case TYPE_DRAG:
876 // the drag layer: input for drag-and-drop is associated with this window,
877 // which sits above all other focusable windows
878 return 29;
879 case TYPE_ACCESSIBILITY_OVERLAY:
880 // overlay put by accessibility services to intercept user interaction
881 return 30;
882 case TYPE_SECURE_SYSTEM_OVERLAY:
883 return 31;
884 case TYPE_BOOT_PROGRESS:
885 return 32;
886 case TYPE_POINTER:
887 // the (mouse) pointer layer
888 return 33;
889 default:
890 Slog.e("WindowManager", "Unknown window type: " + type);
891 return APPLICATION_LAYER;
892 }
893 }
894
895 int APPLICATION_LAYER = 2;
896 int APPLICATION_MEDIA_SUBLAYER = -2;
897 int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1;
898 int APPLICATION_PANEL_SUBLAYER = 1;
899 int APPLICATION_SUB_PANEL_SUBLAYER = 2;
900 int APPLICATION_ABOVE_SUB_PANEL_SUBLAYER = 3;
901
902 /**
903 * Return how to Z-order sub-windows in relation to the window they are attached to.
904 * Return positive to have them ordered in front, negative for behind.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700905 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800906 * @param type The sub-window type code.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700907 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 * @return int Layer in relation to the attached window, where positive is
909 * above and negative is below.
910 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800911 default int getSubWindowLayerFromTypeLw(int type) {
912 switch (type) {
913 case TYPE_APPLICATION_PANEL:
914 case TYPE_APPLICATION_ATTACHED_DIALOG:
915 return APPLICATION_PANEL_SUBLAYER;
916 case TYPE_APPLICATION_MEDIA:
917 return APPLICATION_MEDIA_SUBLAYER;
918 case TYPE_APPLICATION_MEDIA_OVERLAY:
919 return APPLICATION_MEDIA_OVERLAY_SUBLAYER;
920 case TYPE_APPLICATION_SUB_PANEL:
921 return APPLICATION_SUB_PANEL_SUBLAYER;
922 case TYPE_APPLICATION_ABOVE_SUB_PANEL:
923 return APPLICATION_ABOVE_SUB_PANEL_SUBLAYER;
924 }
925 Slog.e("WindowManager", "Unknown sub-window type: " + type);
926 return 0;
927 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800928
929 /**
Dianne Hackborn6136b7e2009-09-18 01:53:49 -0700930 * Get the highest layer (actually one more than) that the wallpaper is
931 * allowed to be in.
932 */
933 public int getMaxWallpaperLayer();
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700934
935 /**
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700936 * Return the display width available after excluding any screen
Jorim Jaggi82c9dc92016-02-05 15:10:33 -0800937 * decorations that could never be removed in Honeycomb. That is, system bar or
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700938 * button bar.
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400939 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800940 public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation,
Andrii Kuliandb8e1062016-11-15 18:30:27 -0800941 int uiMode, int displayId);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400942
943 /**
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700944 * Return the display height available after excluding any screen
Jorim Jaggi82c9dc92016-02-05 15:10:33 -0800945 * decorations that could never be removed in Honeycomb. That is, system bar or
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700946 * button bar.
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400947 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800948 public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation,
Andrii Kuliandb8e1062016-11-15 18:30:27 -0800949 int uiMode, int displayId);
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700950
951 /**
952 * Return the available screen width that we should report for the
953 * configuration. This must be no larger than
Craig Mautner61ac6bb2012-02-02 17:29:33 -0800954 * {@link #getNonDecorDisplayWidth(int, int, int)}; it may be smaller than
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700955 * that to account for more transient decoration like a status bar.
956 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800957 public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation,
Andrii Kuliandb8e1062016-11-15 18:30:27 -0800958 int uiMode, int displayId);
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700959
960 /**
961 * Return the available screen height that we should report for the
962 * configuration. This must be no larger than
Craig Mautner61ac6bb2012-02-02 17:29:33 -0800963 * {@link #getNonDecorDisplayHeight(int, int, int)}; it may be smaller than
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700964 * that to account for more transient decoration like a status bar.
965 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800966 public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation,
Andrii Kuliandb8e1062016-11-15 18:30:27 -0800967 int uiMode, int displayId);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400968
969 /**
Jorim Jaggife762342016-10-13 14:33:27 +0200970 * Return whether the given window can become the Keyguard window. Typically returns true for
971 * the StatusBar.
Jorim Jaggi0d674622014-05-21 01:34:15 +0200972 */
973 public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs);
974
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700975 /**
Jorim Jaggife762342016-10-13 14:33:27 +0200976 * @return whether {@param win} can be hidden by Keyguard
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700977 */
Jorim Jaggife762342016-10-13 14:33:27 +0200978 public boolean canBeHiddenByKeyguardLw(WindowState win);
Craig Mautner7d7808f2014-09-11 18:02:38 -0700979
980 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800981 * Called when the system would like to show a UI to indicate that an
982 * application is starting. You can use this to add a
983 * APPLICATION_STARTING_TYPE window with the given appToken to the window
984 * manager (using the normal window manager APIs) that will be shown until
985 * the application displays its own window. This is called without the
986 * window manager locked so that you can call back into it.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700987 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800988 * @param appToken Token of the application being started.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700989 * @param packageName The name of the application package being started.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800990 * @param theme Resource defining the application's overall visual theme.
991 * @param nonLocalizedLabel The default title label of the application if
992 * no data is found in the resource.
993 * @param labelRes The resource ID the application would like to use as its name.
994 * @param icon The resource ID the application would like to use as its icon.
Dianne Hackborn7eec10e2010-11-12 18:03:47 -0800995 * @param windowFlags Window layout flags.
Wale Ogunwaledfc18622016-04-16 15:08:48 -0700996 * @param overrideConfig override configuration to consider when generating
997 * context to for resources.
Andrii Kulianfb1bf692017-01-17 11:17:34 -0800998 * @param displayId Id of the display to show the splash screen at.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700999 *
Jorim Jaggi02886a82016-12-06 09:10:06 -08001000 * @return The starting surface.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001001 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001002 */
Jorim Jaggiba41f4b2016-12-14 17:43:07 -08001003 public StartingSurface addSplashScreen(IBinder appToken, String packageName, int theme,
1004 CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon,
Andrii Kulianfb1bf692017-01-17 11:17:34 -08001005 int logo, int windowFlags, Configuration overrideConfig, int displayId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001006
1007 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001008 * Prepare for a window being added to the window manager. You can throw an
1009 * exception here to prevent the window being added, or do whatever setup
1010 * you need to keep track of the window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001011 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001012 * @param win The window being added.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001013 * @param attrs The window's LayoutParams.
1014 *
Jeff Brown98365d72012-08-19 20:30:52 -07001015 * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed, else an
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001016 * error code to abort the add.
1017 */
1018 public int prepareAddWindowLw(WindowState win,
1019 WindowManager.LayoutParams attrs);
1020
1021 /**
1022 * Called when a window is being removed from a window manager. Must not
1023 * throw an exception -- clean up as much as possible.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001024 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001025 * @param win The window being removed.
1026 */
1027 public void removeWindowLw(WindowState win);
1028
1029 /**
1030 * Control the animation to run when a window's state changes. Return a
1031 * non-0 number to force the animation to a specific resource ID, or 0
1032 * to use the default animation.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001033 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001034 * @param win The window that is changing.
1035 * @param transit What is happening to the window: {@link #TRANSIT_ENTER},
1036 * {@link #TRANSIT_EXIT}, {@link #TRANSIT_SHOW}, or
1037 * {@link #TRANSIT_HIDE}.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001038 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001039 * @return Resource ID of the actual animation to use, or 0 for none.
1040 */
1041 public int selectAnimationLw(WindowState win, int transit);
1042
1043 /**
Craig Mautner3c174372013-02-21 17:54:37 -08001044 * Determine the animation to run for a rotation transition based on the
1045 * top fullscreen windows {@link WindowManager.LayoutParams#rotationAnimation}
1046 * and whether it is currently fullscreen and frontmost.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001047 *
1048 * @param anim The exiting animation resource id is stored in anim[0], the
Craig Mautner3c174372013-02-21 17:54:37 -08001049 * entering animation resource id is stored in anim[1].
1050 */
1051 public void selectRotationAnimationLw(int anim[]);
1052
1053 /**
1054 * Validate whether the current top fullscreen has specified the same
1055 * {@link WindowManager.LayoutParams#rotationAnimation} value as that
1056 * being passed in from the previous top fullscreen window.
1057 *
1058 * @param exitAnimId exiting resource id from the previous window.
1059 * @param enterAnimId entering resource id from the previous window.
1060 * @param forceDefault For rotation animations only, if true ignore the
1061 * animation values and just return false.
1062 * @return true if the previous values are still valid, false if they
1063 * should be replaced with the default.
1064 */
1065 public boolean validateRotationAnimationLw(int exitAnimId, int enterAnimId,
1066 boolean forceDefault);
1067
1068 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001069 * Create and return an animation to re-display a window that was force hidden by Keyguard.
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001070 */
Jorim Jaggife762342016-10-13 14:33:27 +02001071 public Animation createHiddenByKeyguardExit(boolean onWallpaper,
Jorim Jaggi84a3e7a2014-08-13 17:58:58 +02001072 boolean goingToNotificationShade);
Jorim Jaggi76a16232014-08-08 17:00:47 +02001073
1074 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001075 * Create and return an animation to let the wallpaper disappear after being shown behind
1076 * Keyguard.
Jorim Jaggi76a16232014-08-08 17:00:47 +02001077 */
Jorim Jaggife762342016-10-13 14:33:27 +02001078 public Animation createKeyguardWallpaperExit(boolean goingToNotificationShade);
Jorim Jaggi76a16232014-08-08 17:00:47 +02001079
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001080 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001081 * Called from the input reader thread before a key is enqueued.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001082 *
1083 * <p>There are some actions that need to be handled here because they
1084 * affect the power state of the device, for example, the power keys.
1085 * Generally, it's best to keep as little as possible in the queue thread
1086 * because it's the most fragile.
Jeff Brown1f245102010-11-18 20:53:46 -08001087 * @param event The key event.
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001088 * @param policyFlags The policy flags associated with the key.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001089 *
Jeff Brown26875502014-01-30 21:47:47 -08001090 * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001091 */
Jeff Brown037c33e2014-04-09 00:31:55 -07001092 public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags);
Jeff Brown56194eb2011-03-02 19:23:13 -08001093
1094 /**
Michael Wright70af00a2014-09-03 19:30:20 -07001095 * Called from the input reader thread before a motion is enqueued when the device is in a
1096 * non-interactive state.
Jeff Brown56194eb2011-03-02 19:23:13 -08001097 *
1098 * <p>There are some actions that need to be handled here because they
1099 * affect the power state of the device, for example, waking on motions.
1100 * Generally, it's best to keep as little as possible in the queue thread
1101 * because it's the most fragile.
1102 * @param policyFlags The policy flags associated with the motion.
1103 *
Jeff Brown26875502014-01-30 21:47:47 -08001104 * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
Jeff Brown56194eb2011-03-02 19:23:13 -08001105 */
Michael Wright70af00a2014-09-03 19:30:20 -07001106 public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags);
Jeff Brown56194eb2011-03-02 19:23:13 -08001107
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001108 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001109 * Called from the input dispatcher thread before a key is dispatched to a window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001110 *
1111 * <p>Allows you to define
Jeff Brown3915bb82010-11-05 15:02:16 -07001112 * behavior for keys that can not be overridden by applications.
1113 * This method is called from the input thread, with no locks held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001114 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001115 * @param win The window that currently has focus. This is where the key
1116 * event will normally go.
Jeff Brown1f245102010-11-18 20:53:46 -08001117 * @param event The key event.
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001118 * @param policyFlags The policy flags associated with the key.
Jeff Brownd5bb82d2011-10-12 13:57:59 -07001119 * @return 0 if the key should be dispatched immediately, -1 if the key should
1120 * not be dispatched ever, or a positive value indicating the number of
1121 * milliseconds by which the key dispatch should be delayed before trying
1122 * again.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001123 */
Jeff Brownd5bb82d2011-10-12 13:57:59 -07001124 public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001125
1126 /**
Jeff Brown3915bb82010-11-05 15:02:16 -07001127 * Called from the input dispatcher thread when an application did not handle
1128 * a key that was dispatched to it.
1129 *
1130 * <p>Allows you to define default global behavior for keys that were not handled
1131 * by applications. This method is called from the input thread, with no locks held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001132 *
Jeff Brown3915bb82010-11-05 15:02:16 -07001133 * @param win The window that currently has focus. This is where the key
1134 * event will normally go.
Jeff Brown1f245102010-11-18 20:53:46 -08001135 * @param event The key event.
Jeff Brown3915bb82010-11-05 15:02:16 -07001136 * @param policyFlags The policy flags associated with the key.
Jeff Brown49ed71d2010-12-06 17:13:33 -08001137 * @return Returns an alternate key event to redispatch as a fallback, or null to give up.
1138 * The caller is responsible for recycling the key event.
Jeff Brown3915bb82010-11-05 15:02:16 -07001139 */
Jeff Brown49ed71d2010-12-06 17:13:33 -08001140 public KeyEvent dispatchUnhandledKey(WindowState win, KeyEvent event, int policyFlags);
Jeff Brown3915bb82010-11-05 15:02:16 -07001141
1142 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001143 * Called when layout of the windows is about to start.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001144 *
Craig Mautner69b08182012-09-05 13:07:13 -07001145 * @param isDefaultDisplay true if window is on {@link Display#DEFAULT_DISPLAY}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001146 * @param displayWidth The current full width of the screen.
1147 * @param displayHeight The current full height of the screen.
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -08001148 * @param displayRotation The current rotation being applied to the base window.
1149 * @param uiMode The current uiMode in configuration.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001150 */
Craig Mautner69b08182012-09-05 13:07:13 -07001151 public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight,
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -08001152 int displayRotation, int uiMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001153
1154 /**
John Spurlock46646232013-09-30 22:32:42 -04001155 * Returns the bottom-most layer of the system decor, above which no policy decor should
1156 * be applied.
Dianne Hackborn85afd1b2012-05-13 13:31:06 -07001157 */
John Spurlock46646232013-09-30 22:32:42 -04001158 public int getSystemDecorLayerLw();
Dianne Hackborn85afd1b2012-05-13 13:31:06 -07001159
1160 /**
Craig Mautner967212c2013-04-13 21:10:58 -07001161 * Return the rectangle of the screen that is available for applications to run in.
1162 * This will be called immediately after {@link #beginLayoutLw}.
1163 *
1164 * @param r The rectangle to be filled with the boundaries available to applications.
1165 */
1166 public void getContentRectLw(Rect r);
1167
1168 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001169 * Called for each window attached to the window manager as layout is
1170 * proceeding. The implementation of this function must take care of
1171 * setting the window's frame, either here or in finishLayout().
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001172 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 * @param win The window being positioned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001174 * @param attached For sub-windows, the window it is attached to; this
1175 * window will already have had layoutWindow() called on it
1176 * so you can use its Rect. Otherwise null.
1177 */
Craig Mautnerc9457fa2014-06-06 14:27:48 -07001178 public void layoutWindowLw(WindowState win, WindowState attached);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001179
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001180
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001181 /**
1182 * Return the insets for the areas covered by system windows. These values
1183 * are computed on the most recent layout, so they are not guaranteed to
1184 * be correct.
Adrian Roos37d7a682014-11-06 18:15:16 +01001185 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 * @param attrs The LayoutParams of the window.
Jorim Jaggi23bf5462016-05-13 15:24:39 -07001187 * @param taskBounds The bounds of the task this window is on or {@code null} if no task is
1188 * associated with the window.
1189 * @param displayRotation Rotation of the display.
1190 * @param displayWidth The width of the display.
1191 * @param displayHeight The height of the display.
Adrian Roos37d7a682014-11-06 18:15:16 +01001192 * @param outContentInsets The areas covered by system windows, expressed as positive insets.
1193 * @param outStableInsets The areas covered by stable system windows irrespective of their
1194 * current visibility. Expressed as positive insets.
Filip Gruszczynski0ec13282015-06-25 11:26:01 -07001195 * @param outOutsets The areas that are not real display, but we would like to treat as such.
Jorim Jaggi0ffd49c2016-02-12 15:04:21 -08001196 * @return Whether to always consume the navigation bar.
1197 * See {@link #isNavBarForcedShownLw(WindowState)}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001198 */
Jorim Jaggi23bf5462016-05-13 15:24:39 -07001199 public boolean getInsetHintLw(WindowManager.LayoutParams attrs, Rect taskBounds,
1200 int displayRotation, int displayWidth, int displayHeight, Rect outContentInsets,
1201 Rect outStableInsets, Rect outOutsets);
Dianne Hackborn85afd1b2012-05-13 13:31:06 -07001202
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 /**
1204 * Called when layout of the windows is finished. After this function has
1205 * returned, all windows given to layoutWindow() <em>must</em> have had a
1206 * frame assigned.
1207 */
Craig Mautner61ac6bb2012-02-02 17:29:33 -08001208 public void finishLayoutLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001209
Dianne Hackborn9bfb7072009-09-22 11:37:40 -07001210 /** Layout state may have changed (so another layout will be performed) */
1211 static final int FINISH_LAYOUT_REDO_LAYOUT = 0x0001;
1212 /** Configuration state may have changed */
1213 static final int FINISH_LAYOUT_REDO_CONFIG = 0x0002;
1214 /** Wallpaper may need to move */
1215 static final int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004;
Dianne Hackbornb8b11a02010-03-10 15:53:11 -08001216 /** Need to recompute animations */
1217 static final int FINISH_LAYOUT_REDO_ANIM = 0x0008;
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001218
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001219 /**
Craig Mautner39834192012-09-02 07:47:24 -07001220 * Called following layout of all windows before each window has policy applied.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001221 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 * @param displayWidth The current full width of the screen.
1223 * @param displayHeight The current full height of the screen.
1224 */
Craig Mautner39834192012-09-02 07:47:24 -07001225 public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001226
1227 /**
Craig Mautner39834192012-09-02 07:47:24 -07001228 * Called following layout of all window to apply policy to each window.
Yohei Yukawad1a09222015-06-30 16:22:05 -07001229 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001230 * @param win The window being positioned.
Yohei Yukawad1a09222015-06-30 16:22:05 -07001231 * @param attrs The LayoutParams of the window.
1232 * @param attached For sub-windows, the window it is attached to. Otherwise null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001233 */
Craig Mautner39834192012-09-02 07:47:24 -07001234 public void applyPostLayoutPolicyLw(WindowState win,
Jorim Jaggife762342016-10-13 14:33:27 +02001235 WindowManager.LayoutParams attrs, WindowState attached, WindowState imeTarget);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001236
1237 /**
Craig Mautner39834192012-09-02 07:47:24 -07001238 * Called following layout of all windows and after policy has been applied
1239 * to each window. If in this function you do
1240 * something that may have modified the animation state of another window,
1241 * be sure to return non-zero in order to perform another pass through layout.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001242 *
Dianne Hackbornb8b11a02010-03-10 15:53:11 -08001243 * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT},
1244 * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER},
1245 * or {@link #FINISH_LAYOUT_REDO_ANIM}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001246 */
Craig Mautner39834192012-09-02 07:47:24 -07001247 public int finishPostLayoutPolicyLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001248
1249 /**
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001250 * Return true if it is okay to perform animations for an app transition
1251 * that is about to occur. You may return false for this if, for example,
1252 * the lock screen is currently displayed so the switch should happen
1253 * immediately.
1254 */
1255 public boolean allowAppAnimationsLw();
Joe Onorato664644d2011-01-23 17:53:23 -08001256
1257
1258 /**
1259 * A new window has been focused.
1260 */
Dianne Hackborndf89e652011-10-06 22:35:11 -07001261 public int focusChangedLw(WindowState lastFocus, WindowState newFocus);
Jeff Brown36c4db82014-09-19 12:05:31 -07001262
1263 /**
Jeff Brown416c49c2015-05-26 19:50:18 -07001264 * Called when the device has started waking up.
Jeff Brown36c4db82014-09-19 12:05:31 -07001265 */
Jeff Brown416c49c2015-05-26 19:50:18 -07001266 public void startedWakingUp();
Jeff Brown36c4db82014-09-19 12:05:31 -07001267
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001268 /**
Jeff Brown416c49c2015-05-26 19:50:18 -07001269 * Called when the device has finished waking up.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001270 */
Jeff Brown416c49c2015-05-26 19:50:18 -07001271 public void finishedWakingUp();
1272
1273 /**
1274 * Called when the device has started going to sleep.
1275 *
1276 * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN},
1277 * or {@link #OFF_BECAUSE_OF_TIMEOUT}.
1278 */
1279 public void startedGoingToSleep(int why);
1280
1281 /**
1282 * Called when the device has finished going to sleep.
1283 *
1284 * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN},
1285 * or {@link #OFF_BECAUSE_OF_TIMEOUT}.
1286 */
1287 public void finishedGoingToSleep(int why);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001288
Jeff Brown36c4db82014-09-19 12:05:31 -07001289 /**
1290 * Called when the device is about to turn on the screen to show content.
1291 * When waking up, this method will be called once after the call to wakingUp().
1292 * When dozing, the method will be called sometime after the call to goingToSleep() and
1293 * may be called repeatedly in the case where the screen is pulsing on and off.
1294 *
1295 * Must call back on the listener to tell it when the higher-level system
1296 * is ready for the screen to go on (i.e. the lock screen is shown).
1297 */
1298 public void screenTurningOn(ScreenOnListener screenOnListener);
1299
Jeff Brown3ee549c2014-09-22 20:14:39 -07001300 /**
Jorim Jaggi0d210f62015-07-10 14:24:44 -07001301 * Called when the device has actually turned on the screen, i.e. the display power state has
1302 * been set to ON and the screen is unblocked.
1303 */
1304 public void screenTurnedOn();
1305
1306 /**
Jorim Jaggi51304d72017-05-17 17:25:32 +02001307 * Called when the display would like to be turned off. This gives policy a chance to do some
1308 * things before the display power state is actually changed to off.
1309 *
1310 * @param screenOffListener Must be called to tell that the display power state can actually be
1311 * changed now after policy has done its work.
1312 */
1313 public void screenTurningOff(ScreenOffListener screenOffListener);
1314
1315 /**
Jeff Brown3ee549c2014-09-22 20:14:39 -07001316 * Called when the device has turned the screen off.
1317 */
1318 public void screenTurnedOff();
1319
Dianne Hackborn38e29a62011-09-18 14:43:08 -07001320 public interface ScreenOnListener {
1321 void onScreenOn();
Craig Mautner61ac6bb2012-02-02 17:29:33 -08001322 }
Dianne Hackborn38e29a62011-09-18 14:43:08 -07001323
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001324 /**
Jorim Jaggi51304d72017-05-17 17:25:32 +02001325 * See {@link #screenTurnedOff}
1326 */
1327 public interface ScreenOffListener {
1328 void onScreenOff();
1329 }
1330
1331 /**
Jeff Brown3ee549c2014-09-22 20:14:39 -07001332 * Return whether the default display is on and not blocked by a black surface.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001333 */
Jeff Brown3ee549c2014-09-22 20:14:39 -07001334 public boolean isScreenOn();
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001335
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001336 /**
Adrian Roos7c894802017-07-19 12:25:34 +02001337 * @return whether the device is currently allowed to animate.
Adrian Roose94c15c2017-05-09 13:17:54 -07001338 *
Adrian Roos7c894802017-07-19 12:25:34 +02001339 * Note: this can be true even if it is not appropriate to animate for reasons that are outside
1340 * of the policy's authority.
Adrian Roose94c15c2017-05-09 13:17:54 -07001341 */
Adrian Roos7c894802017-07-19 12:25:34 +02001342 boolean okToAnimate();
Adrian Roose94c15c2017-05-09 13:17:54 -07001343
1344 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001345 * Tell the policy that the lid switch has changed state.
1346 * @param whenNanos The time when the change occurred in uptime nanoseconds.
1347 * @param lidOpen True if the lid is now open.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001348 */
Jeff Brown46b9ac02010-04-22 18:58:52 -07001349 public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen);
Michael Wright3818c922014-09-02 13:59:07 -07001350
1351 /**
1352 * Tell the policy that the camera lens has been covered or uncovered.
1353 * @param whenNanos The time when the change occurred in uptime nanoseconds.
1354 * @param lensCovered True if the lens is covered.
1355 */
1356 public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered);
1357
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001359 * Tell the policy if anyone is requesting that keyguard not come on.
1360 *
1361 * @param enabled Whether keyguard can be on or not. does not actually
1362 * turn it on, unless it was previously disabled with this function.
1363 *
1364 * @see android.app.KeyguardManager.KeyguardLock#disableKeyguard()
1365 * @see android.app.KeyguardManager.KeyguardLock#reenableKeyguard()
1366 */
Craig Mautner3c174372013-02-21 17:54:37 -08001367 @SuppressWarnings("javadoc")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 public void enableKeyguard(boolean enabled);
1369
1370 /**
1371 * Callback used by {@link WindowManagerPolicy#exitKeyguardSecurely}
1372 */
1373 interface OnKeyguardExitResult {
1374 void onKeyguardExitResult(boolean success);
1375 }
1376
1377 /**
1378 * Tell the policy if anyone is requesting the keyguard to exit securely
1379 * (this would be called after the keyguard was disabled)
1380 * @param callback Callback to send the result back.
1381 * @see android.app.KeyguardManager#exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult)
1382 */
Craig Mautner3c174372013-02-21 17:54:37 -08001383 @SuppressWarnings("javadoc")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 void exitKeyguardSecurely(OnKeyguardExitResult callback);
1385
1386 /**
Mike Lockwood520d8bc2011-02-18 13:23:13 -05001387 * isKeyguardLocked
1388 *
1389 * Return whether the keyguard is currently locked.
1390 *
1391 * @return true if in keyguard is locked.
1392 */
1393 public boolean isKeyguardLocked();
1394
1395 /**
1396 * isKeyguardSecure
1397 *
1398 * Return whether the keyguard requires a password to unlock.
Jim Millere4044bb2016-05-10 18:38:25 -07001399 * @param userId
Mike Lockwood520d8bc2011-02-18 13:23:13 -05001400 *
1401 * @return true if in keyguard is secure.
1402 */
Jim Millere4044bb2016-05-10 18:38:25 -07001403 public boolean isKeyguardSecure(int userId);
Mike Lockwood520d8bc2011-02-18 13:23:13 -05001404
1405 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001406 * Return whether the keyguard is currently occluded.
Adrian Roos461829d2015-06-03 14:41:18 -07001407 *
Jorim Jaggife762342016-10-13 14:33:27 +02001408 * @return true if in keyguard is occluded, false otherwise
Adrian Roos461829d2015-06-03 14:41:18 -07001409 */
Jorim Jaggife762342016-10-13 14:33:27 +02001410 public boolean isKeyguardOccluded();
Adrian Roos461829d2015-06-03 14:41:18 -07001411
1412 /**
Tony Mak2c0d6dc2016-04-29 16:16:54 +01001413 * @return true if in keyguard is on and not occluded.
1414 */
1415 public boolean isKeyguardShowingAndNotOccluded();
1416
1417 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001418 * @return whether Keyguard is in trusted state and can be dismissed without credentials
1419 */
1420 public boolean isKeyguardTrustedLw();
1421
1422 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001423 * inKeyguardRestrictedKeyInputMode
1424 *
1425 * if keyguard screen is showing or in restricted key input mode (i.e. in
1426 * keyguard password emergency screen). When in such mode, certain keys,
1427 * such as the Home key and the right soft keys, don't work.
1428 *
1429 * @return true if in keyguard restricted input mode.
1430 */
1431 public boolean inKeyguardRestrictedKeyInputMode();
1432
1433 /**
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001434 * Ask the policy to dismiss the keyguard, if it is currently shown.
Jorim Jaggi241ae102016-11-02 21:57:33 -07001435 *
1436 * @param callback Callback to be informed about the result.
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001437 */
Jorim Jaggi241ae102016-11-02 21:57:33 -07001438 public void dismissKeyguardLw(@Nullable IKeyguardDismissCallback callback);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001439
1440 /**
Jorim Jaggicff0acb2014-03-31 16:35:15 +02001441 * Ask the policy whether the Keyguard has drawn. If the Keyguard is disabled, this method
1442 * returns true as soon as we know that Keyguard is disabled.
1443 *
1444 * @return true if the keyguard has drawn.
1445 */
1446 public boolean isKeyguardDrawnLw();
1447
Jorim Jaggi77e10432016-10-26 17:43:56 -07001448 public boolean isShowingDreamLw();
1449
Jorim Jaggicff0acb2014-03-31 16:35:15 +02001450 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -07001451 * Given an orientation constant, returns the appropriate surface rotation,
1452 * taking into account sensors, docking mode, rotation lock, and other factors.
1453 *
1454 * @param orientation An orientation constant, such as
1455 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
1456 * @param lastRotation The most recently used rotation.
1457 * @return The surface rotation to use.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001459 public int rotationForOrientationLw(@ActivityInfo.ScreenOrientation int orientation,
1460 int lastRotation);
Jeff Brown01a98dd2011-09-20 15:08:29 -07001461
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001462 /**
Jeff Brown01a98dd2011-09-20 15:08:29 -07001463 * Given an orientation constant and a rotation, returns true if the rotation
1464 * has compatible metrics to the requested orientation. For example, if
1465 * the application requested landscape and got seascape, then the rotation
1466 * has compatible metrics; if the application requested portrait and got landscape,
1467 * then the rotation has incompatible metrics; if the application did not specify
1468 * a preference, then anything goes.
1469 *
1470 * @param orientation An orientation constant, such as
1471 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
1472 * @param rotation The rotation to check.
1473 * @return True if the rotation is compatible with the requested orientation.
Dianne Hackborndacea8c2011-04-21 17:26:39 -07001474 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001475 public boolean rotationHasCompatibleMetricsLw(@ActivityInfo.ScreenOrientation int orientation,
1476 int rotation);
Dianne Hackborndacea8c2011-04-21 17:26:39 -07001477
1478 /**
Jeff Brownc0347aa2011-09-23 17:26:09 -07001479 * Called by the window manager when the rotation changes.
1480 *
1481 * @param rotation The new rotation.
1482 */
1483 public void setRotationLw(int rotation);
1484
1485 /**
Jeff Brownac143512012-04-05 18:57:33 -07001486 * Called when the system is mostly done booting to set whether
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001487 * the system should go into safe mode.
1488 */
Jeff Brownac143512012-04-05 18:57:33 -07001489 public void setSafeMode(boolean safeMode);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001490
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001491 /**
1492 * Called when the system is mostly done booting.
1493 */
1494 public void systemReady();
1495
1496 /**
Dianne Hackbornba24e4d2011-09-01 11:17:06 -07001497 * Called when the system is done booting to the point where the
1498 * user can start interacting with it.
1499 */
1500 public void systemBooted();
1501
1502 /**
Dianne Hackborn661cd522011-08-22 00:26:20 -07001503 * Show boot time message to the user.
1504 */
1505 public void showBootMessage(final CharSequence msg, final boolean always);
1506
1507 /**
1508 * Hide the UI for showing boot messages, never to be displayed again.
1509 */
1510 public void hideBootMessages();
1511
1512 /**
Mike Lockwoodef731622010-01-27 17:51:34 -05001513 * Called when userActivity is signalled in the power manager.
1514 * This is safe to call from any thread, with any window manager locks held or not.
1515 */
1516 public void userActivity();
1517
1518 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001519 * Called when we have finished booting and can now display the home
Jeff Brownc042ee22012-05-08 13:03:42 -07001520 * screen to the user. This will happen after systemReady(), and at
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001521 * this point the display is active.
1522 */
1523 public void enableScreenAfterBoot();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001524
Tor Norbyed9273d62013-05-30 15:59:53 -07001525 public void setCurrentOrientationLw(@ActivityInfo.ScreenOrientation int newOrientation);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001526
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001527 /**
1528 * Call from application to perform haptic feedback on its window.
1529 */
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -07001530 public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001531
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001532 /**
Daniel Sandler0601eb72011-04-13 01:01:32 -04001533 * Called when we have started keeping the screen on because a window
1534 * requesting this has become visible.
1535 */
Jeff Brownc38c9be2012-10-04 13:16:19 -07001536 public void keepScreenOnStartedLw();
Daniel Sandler0601eb72011-04-13 01:01:32 -04001537
1538 /**
1539 * Called when we have stopped keeping the screen on because the last window
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001540 * requesting this is no longer visible.
1541 */
Jeff Brownc38c9be2012-10-04 13:16:19 -07001542 public void keepScreenOnStoppedLw();
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001543
1544 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001545 * Gets the current user rotation mode.
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001546 *
1547 * @return The rotation mode.
1548 *
1549 * @see WindowManagerPolicy#USER_ROTATION_LOCKED
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001550 * @see WindowManagerPolicy#USER_ROTATION_FREE
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001551 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001552 @UserRotationMode
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001553 public int getUserRotationMode();
1554
1555 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001556 * Inform the policy that the user has chosen a preferred orientation ("rotation lock").
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001557 *
1558 * @param mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001559 * {@link WindowManagerPolicy#USER_ROTATION_FREE}.
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001560 * @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90},
Craig Mautner69b08182012-09-05 13:07:13 -07001561 * {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}.
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001562 */
Tor Norbyed9273d62013-05-30 15:59:53 -07001563 public void setUserRotationMode(@UserRotationMode int mode, @Surface.Rotation int rotation);
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001564
1565 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -07001566 * Called when a new system UI visibility is being reported, allowing
1567 * the policy to adjust what is actually reported.
Tor Norbyed9273d62013-05-30 15:59:53 -07001568 * @param visibility The raw visibility reported by the status bar.
Dianne Hackborndf89e652011-10-06 22:35:11 -07001569 * @return The new desired visibility.
1570 */
1571 public int adjustSystemUiVisibilityLw(int visibility);
1572
1573 /**
Winsonab216602016-08-09 14:05:20 -07001574 * Called by System UI to notify of changes to the visibility of Recents.
1575 */
1576 public void setRecentsVisibilityLw(boolean visible);
1577
1578 /**
1579 * Called by System UI to notify of changes to the visibility of PIP.
1580 */
Winson Chungac52f282017-03-30 14:44:52 -07001581 void setPipVisibilityLw(boolean visible);
Winsonab216602016-08-09 14:05:20 -07001582
1583 /**
Daniel Sandler0c4ccff2011-10-19 16:39:14 -04001584 * Specifies whether there is an on-screen navigation bar separate from the status bar.
1585 */
1586 public boolean hasNavigationBar();
1587
1588 /**
Jim Miller93c518e2012-01-17 15:55:31 -08001589 * Lock the device now.
1590 */
Adam Cohenf7522022012-10-03 20:03:18 -07001591 public void lockNow(Bundle options);
Jim Miller93c518e2012-01-17 15:55:31 -08001592
1593 /**
satok1bc0a492012-04-25 22:47:12 +09001594 * Set the last used input method window state. This state is used to make IME transition
1595 * smooth.
1596 * @hide
1597 */
1598 public void setLastInputMethodWindowLw(WindowState ime, WindowState target);
1599
1600 /**
Yohei Yukawad6475a62017-04-17 10:35:27 -07001601 * An internal callback (from InputMethodManagerService) to notify a state change regarding
1602 * whether the back key should dismiss the software keyboard (IME) or not.
1603 *
1604 * @param newValue {@code true} if the software keyboard is shown and the back key is expected
1605 * to dismiss the software keyboard.
1606 * @hide
1607 */
1608 default void setDismissImeOnBackKeyPressed(boolean newValue) {
1609 // Default implementation does nothing.
1610 }
1611
1612 /**
Craig Mautner84984fa2014-06-19 11:19:20 -07001613 * Show the recents task list app.
1614 * @hide
1615 */
Jorim Jaggi681fc7b2016-04-14 22:02:39 -07001616 public void showRecentApps(boolean fromHome);
Craig Mautner84984fa2014-06-19 11:19:20 -07001617
1618 /**
Alan Viverettee34560b22014-07-10 14:50:06 -07001619 * Show the global actions dialog.
1620 * @hide
1621 */
1622 public void showGlobalActions();
1623
1624 /**
Satoshi Kataoka658c7b82013-10-10 17:03:51 +09001625 * @return The current height of the input method window.
1626 */
1627 public int getInputMethodWindowVisibleHeightLw();
1628
1629 /**
Craig Mautnerf1b67412012-09-19 13:18:29 -07001630 * Called when the current user changes. Guaranteed to be called before the broadcast
1631 * of the new user id is made to all listeners.
1632 *
1633 * @param newUserId The id of the incoming user.
1634 */
1635 public void setCurrentUserLw(int newUserId);
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001636
1637 /**
Evan Rosky18396452016-07-27 15:19:37 -07001638 * For a given user-switch operation, this will be called once with switching=true before the
1639 * user-switch and once with switching=false afterwards (or if the user-switch was cancelled).
1640 * This gives the policy a chance to alter its behavior for the duration of a user-switch.
1641 *
1642 * @param switching true if a user-switch is in progress
1643 */
1644 void setSwitchingUser(boolean switching);
1645
1646 /**
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001647 * Print the WindowManagerPolicy's state into the given stream.
1648 *
1649 * @param prefix Text to print at the front of each line.
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001650 * @param writer The PrintWriter to which you should dump your state. This will be
1651 * closed for you after you return.
1652 * @param args additional arguments to the dump request.
1653 */
Jeff Brownd7a04de2012-06-17 14:17:52 -07001654 public void dump(String prefix, PrintWriter writer, String[] args);
Jim Miller4eeb4f62012-11-08 00:04:29 -08001655
1656 /**
Steven Timotiusaf03df62017-07-18 16:56:43 -07001657 * Write the WindowManagerPolicy's state into the protocol buffer.
1658 * The message is described in {@link com.android.server.wm.proto.WindowManagerPolicyProto}
1659 *
1660 * @param proto The protocol buffer output stream to write to.
1661 */
1662 void writeToProto(ProtoOutputStream proto, long fieldId);
1663
1664 /**
Svetoslav Ganov545252f2012-12-10 18:29:24 -08001665 * Returns whether a given window type can be magnified.
1666 *
1667 * @param windowType The window type.
1668 * @return True if the window can be magnified.
1669 */
1670 public boolean canMagnifyWindow(int windowType);
1671
1672 /**
1673 * Returns whether a given window type is considered a top level one.
1674 * A top level window does not have a container, i.e. attached window,
1675 * or if it has a container it is laid out as a top-level window, not
1676 * as a child of its container.
1677 *
1678 * @param windowType The window type.
1679 * @return True if the window is a top level one.
1680 */
1681 public boolean isTopLevelWindow(int windowType);
Jorim Jaggi0d674622014-05-21 01:34:15 +02001682
1683 /**
1684 * Notifies the keyguard to start fading out.
Jorim Jaggie29b2db2014-05-30 23:17:03 +02001685 *
1686 * @param startTime the start time of the animation in uptime milliseconds
1687 * @param fadeoutDuration the duration of the exit animation, in milliseconds
Jorim Jaggi0d674622014-05-21 01:34:15 +02001688 */
Jorim Jaggie29b2db2014-05-30 23:17:03 +02001689 public void startKeyguardExitAnimation(long startTime, long fadeoutDuration);
Jorim Jaggi737af722015-12-31 10:42:27 +01001690
1691 /**
1692 * Calculates the stable insets without running a layout.
1693 *
1694 * @param displayRotation the current display rotation
Jorim Jaggi737af722015-12-31 10:42:27 +01001695 * @param displayWidth the current display width
1696 * @param displayHeight the current display height
Winson3e874742016-01-07 10:08:17 -08001697 * @param outInsets the insets to return
Jorim Jaggi737af722015-12-31 10:42:27 +01001698 */
1699 public void getStableInsetsLw(int displayRotation, int displayWidth, int displayHeight,
1700 Rect outInsets);
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001701
Jorim Jaggi0ffd49c2016-02-12 15:04:21 -08001702
1703 /**
1704 * @return true if the navigation bar is forced to stay visible
1705 */
1706 public boolean isNavBarForcedShownLw(WindowState win);
1707
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001708 /**
Andrii Kulian3a1619d2017-07-07 14:38:09 -07001709 * @return The side of the screen where navigation bar is positioned.
1710 * @see #NAV_BAR_LEFT
1711 * @see #NAV_BAR_RIGHT
1712 * @see #NAV_BAR_BOTTOM
1713 */
1714 int getNavBarPosition();
1715
1716 /**
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001717 * Calculates the insets for the areas that could never be removed in Honeycomb, i.e. system
1718 * bar or button bar. See {@link #getNonDecorDisplayWidth}.
1719 *
1720 * @param displayRotation the current display rotation
1721 * @param displayWidth the current display width
1722 * @param displayHeight the current display height
1723 * @param outInsets the insets to return
1724 */
1725 public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight,
1726 Rect outInsets);
Jorim Jaggi5060bd82016-02-19 17:12:19 -08001727
1728 /**
1729 * @return True if a specified {@param dockSide} is allowed on the current device, or false
1730 * otherwise. It is guaranteed that at least one dock side for a particular orientation
1731 * is allowed, so for example, if DOCKED_RIGHT is not allowed, DOCKED_LEFT is allowed.
1732 */
1733 public boolean isDockSideAllowed(int dockSide);
Jorim Jaggi11c62e12016-04-05 20:41:21 -07001734
1735 /**
1736 * Called when the configuration has changed, and it's safe to load new values from resources.
1737 */
1738 public void onConfigurationChanged();
Robert Carr6da3cc02016-06-16 15:17:07 -07001739
1740 public boolean shouldRotateSeamlessly(int oldRotation, int newRotation);
Keun-young Park4136d2d2017-05-08 14:51:59 -07001741
1742 /**
1743 * Called when System UI has been started.
1744 */
1745 void onSystemUiStarted();
1746
1747 /**
1748 * Checks whether the policy is ready for dismissing the boot animation and completing the boot.
1749 *
1750 * @return true if ready; false otherwise.
1751 */
1752 boolean canDismissBootAnimation();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001753}