blob: 37b769b38ea39d2545d0fce46bad4ff38d2f1257 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
Adrian Roose99bc052017-11-20 17:55:31 +01002 * Copyright (C) 2017 The Android Open Source Project
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003 *
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
Adrian Roose99bc052017-11-20 17:55:31 +010017package com.android.server.policy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080018
Wale Ogunwale5cd907d2017-01-26 14:14:08 -080019import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
20import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
21import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
22import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL;
23import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
24import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
25import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY;
26import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
27import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
28import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL;
29import static android.view.WindowManager.LayoutParams.TYPE_BOOT_PROGRESS;
30import static android.view.WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY;
31import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
32import static android.view.WindowManager.LayoutParams.TYPE_DRAG;
33import static android.view.WindowManager.LayoutParams.TYPE_DREAM;
34import static android.view.WindowManager.LayoutParams.TYPE_INPUT_CONSUMER;
35import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
36import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
37import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG;
38import static android.view.WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY;
39import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
40import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
41import static android.view.WindowManager.LayoutParams.TYPE_PHONE;
42import static android.view.WindowManager.LayoutParams.TYPE_POINTER;
43import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION;
44import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
45import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
46import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG;
47import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT;
48import static android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR;
49import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
50import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
51import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL;
52import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL;
53import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
54import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG;
55import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
56import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
57import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
58import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION;
59import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION_STARTING;
60import static android.view.WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY;
61import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
62import static android.view.WindowManager.LayoutParams.isSystemAlertWindowType;
63
Yohei Yukawad0a66b22018-01-10 13:19:54 -080064import static java.lang.annotation.RetentionPolicy.SOURCE;
65
Tor Norbyed9273d62013-05-30 15:59:53 -070066import android.annotation.IntDef;
Jorim Jaggi241ae102016-11-02 21:57:33 -070067import android.annotation.Nullable;
Benjamin Franz3662b152018-01-16 17:23:44 +000068import android.app.ActivityManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069import android.content.Context;
Dianne Hackborn2f0b1752011-05-31 17:59:49 -070070import android.content.res.CompatibilityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080071import android.content.res.Configuration;
72import android.graphics.Rect;
Adam Cohenf7522022012-10-03 20:03:18 -070073import android.os.Bundle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074import android.os.IBinder;
Dianne Hackborndf89e652011-10-06 22:35:11 -070075import android.os.Looper;
Muyuan Li94ce94e2016-02-24 16:20:54 -080076import android.os.RemoteException;
Wale Ogunwale5cd907d2017-01-26 14:14:08 -080077import android.util.Slog;
Steven Timotiusaf03df62017-07-18 16:56:43 -070078import android.util.proto.ProtoOutputStream;
Adrian Roose99bc052017-11-20 17:55:31 +010079import android.view.Display;
Adrian Roos5c6b6222017-11-07 17:36:10 +010080import android.view.DisplayCutout;
Adrian Roose99bc052017-11-20 17:55:31 +010081import android.view.IApplicationToken;
82import android.view.IWindowManager;
83import android.view.InputEventReceiver;
84import android.view.KeyEvent;
Adrian Roose99bc052017-11-20 17:55:31 +010085import android.view.WindowManager;
86import android.view.WindowManagerGlobal;
87import android.view.WindowManagerPolicyConstants;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088import android.view.animation.Animation;
Aurimas Liutikas67e2ae82016-10-11 18:17:42 -070089
Jorim Jaggi241ae102016-11-02 21:57:33 -070090import com.android.internal.policy.IKeyguardDismissCallback;
Muyuan Li94ce94e2016-02-24 16:20:54 -080091import com.android.internal.policy.IShortcutService;
Adrian Roose99bc052017-11-20 17:55:31 +010092import com.android.server.wm.DisplayFrames;
Riddle Hsuad256a12018-07-18 16:11:30 +080093import com.android.server.wm.DisplayRotation;
chaviw553b0212018-07-12 13:37:01 -070094import com.android.server.wm.WindowFrames;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095
Dianne Hackbornf99f9c52011-01-12 15:49:25 -080096import java.io.PrintWriter;
Tor Norbyed9273d62013-05-30 15:59:53 -070097import java.lang.annotation.Retention;
98import java.lang.annotation.RetentionPolicy;
Dianne Hackbornf99f9c52011-01-12 15:49:25 -080099
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100/**
101 * This interface supplies all UI-specific behavior of the window manager. An
102 * instance of it is created by the window manager when it starts up, and allows
103 * customization of window layering, special window types, key dispatching, and
104 * layout.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700105 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106 * <p>Because this provides deep interaction with the system window manager,
107 * specific methods on this interface can be called from a variety of contexts
108 * with various restrictions on what they can do. These are encoded through
109 * a suffixes at the end of a method encoding the thread the method is called
110 * from and any locks that are held when it is being called; if no suffix
111 * is attached to a method, then it is not called with any locks and may be
112 * called from the main window manager thread or another thread calling into
113 * the window manager.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700114 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 * <p>The current suffixes are:
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700116 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 * <dl>
118 * <dt> Ti <dd> Called from the input thread. This is the thread that
119 * collects pending input events and dispatches them to the appropriate window.
120 * It may block waiting for events to be processed, so that the input stream is
121 * properly serialized.
122 * <dt> Tq <dd> Called from the low-level input queue thread. This is the
123 * thread that reads events out of the raw input devices and places them
124 * into the global input queue that is read by the <var>Ti</var> thread.
125 * This thread should not block for a long period of time on anything but the
126 * key driver.
127 * <dt> Lw <dd> Called with the main window manager lock held. Because the
128 * window manager is a very low-level system service, there are few other
129 * system services you can call with this lock held. It is explicitly okay to
130 * make calls into the package manager and power manager; it is explicitly not
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -0700131 * okay to make calls into the activity manager or most other services. Note that
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 * {@link android.content.Context#checkPermission(String, int, int)} and
133 * variations require calling into the activity manager.
134 * <dt> Li <dd> Called with the input thread lock held. This lock can be
135 * acquired by the window manager while it holds the window lock, so this is
136 * even more restrictive than <var>Lw</var>.
137 * </dl>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800138 */
Adrian Roose99bc052017-11-20 17:55:31 +0100139public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
Yohei Yukawad0a66b22018-01-10 13:19:54 -0800140 @Retention(SOURCE)
141 @IntDef({NAV_BAR_LEFT, NAV_BAR_RIGHT, NAV_BAR_BOTTOM})
142 @interface NavigationBarPosition {}
143
Bryce Lee01b0c5f2015-02-05 18:24:04 -0800144 /**
Jeff Brownd5bb82d2011-10-12 13:57:59 -0700145 * Pass this event to the user / app. To be returned from
146 * {@link #interceptKeyBeforeQueueing}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800147 */
Adrian Roose99bc052017-11-20 17:55:31 +0100148 int ACTION_PASS_TO_USER = 0x00000001;
149 /** Layout state may have changed (so another layout will be performed) */
150 int FINISH_LAYOUT_REDO_LAYOUT = 0x0001;
151 /** Configuration state may have changed */
152 int FINISH_LAYOUT_REDO_CONFIG = 0x0002;
153 /** Wallpaper may need to move */
154 int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004;
155 /** Need to recompute animations */
156 int FINISH_LAYOUT_REDO_ANIM = 0x0008;
Vishnu Nair83537a72018-07-19 21:27:48 -0700157 /** Layer for the screen off animation */
158 int COLOR_FADE_LAYER = 0x40000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159
160 /**
Muyuan Li94ce94e2016-02-24 16:20:54 -0800161 * Register shortcuts for window manager to dispatch.
162 * Shortcut code is packed as (metaState << Integer.SIZE) | keyCode
163 * @hide
164 */
165 void registerShortcutKey(long shortcutCode, IShortcutService shortcutKeyReceiver)
166 throws RemoteException;
167
168 /**
Jorim Jaggife762342016-10-13 14:33:27 +0200169 * Called when the Keyguard occluded state changed.
170 * @param occluded Whether Keyguard is currently occluded or not.
Adrian Roosd88eb262016-08-04 14:50:48 -0700171 */
Jorim Jaggife762342016-10-13 14:33:27 +0200172 void onKeyguardOccludedChangedLw(boolean occluded);
Adrian Roosd88eb262016-08-04 14:50:48 -0700173
174 /**
Adrian Roos2f1a90b2018-01-09 17:28:49 +0100175 * Called when the resource overlays change.
176 */
Riddle Hsuad256a12018-07-18 16:11:30 +0800177 default void onOverlayChangedLw(DisplayContentInfo displayContentInfo) {}
Adrian Roos2f1a90b2018-01-09 17:28:49 +0100178
179 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800180 * Interface to the Window Manager state associated with a particular
181 * window. You can hold on to an instance of this interface from the call
182 * to prepareAddWindow() until removeWindow().
183 */
184 public interface WindowState {
185 /**
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800186 * Return the uid of the app that owns this window.
187 */
188 int getOwningUid();
189
190 /**
191 * Return the package name of the app that owns this window.
192 */
193 String getOwningPackage();
194
195 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800196 * Perform standard frame computation. The result can be obtained with
197 * getFrame() if so desired. Must be called with the window manager
198 * lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700199 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800200 */
chaviw1454b392018-08-06 09:54:04 -0700201 public void computeFrameLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800202
203 /**
204 * Retrieve the current frame of the window that has been assigned by
205 * the window manager. Must be called with the window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700206 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800207 * @return Rect The rectangle holding the window frame.
208 */
209 public Rect getFrameLw();
210
211 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800212 * Retrieve the frame of the display that this window was last
213 * laid out in. Must be called with the
214 * window manager lock held.
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700215 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800216 * @return Rect The rectangle holding the display frame.
217 */
218 public Rect getDisplayFrameLw();
219
220 /**
Dianne Hackbornc4aad012013-02-22 15:05:25 -0800221 * Retrieve the frame of the area inside the overscan region of the
222 * display that this window was last laid out in. Must be called with the
223 * window manager lock held.
224 *
225 * @return Rect The rectangle holding the display overscan frame.
226 */
227 public Rect getOverscanFrameLw();
228
229 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800230 * Retrieve the frame of the content area that this window was last
231 * laid out in. This is the area in which the content of the window
232 * should be placed. It will be smaller than the display frame to
233 * account for screen decorations such as a status bar or soft
234 * keyboard. Must be called with the
235 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700236 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800237 * @return Rect The rectangle holding the content frame.
238 */
239 public Rect getContentFrameLw();
240
241 /**
242 * Retrieve the frame of the visible area that this window was last
243 * laid out in. This is the area of the screen in which the window
244 * will actually be fully visible. It will be smaller than the
245 * content frame to account for transient UI elements blocking it
246 * such as an input method's candidates UI. Must be called with the
247 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700248 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800249 * @return Rect The rectangle holding the visible frame.
250 */
251 public Rect getVisibleFrameLw();
252
253 /**
254 * Returns true if this window is waiting to receive its given
255 * internal insets from the client app, and so should not impact the
256 * layout of other windows.
257 */
258 public boolean getGivenInsetsPendingLw();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700259
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800260 /**
261 * Retrieve the insets given by this window's client for the content
262 * area of windows behind it. Must be called with the
263 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700264 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800265 * @return Rect The left, top, right, and bottom insets, relative
266 * to the window's frame, of the actual contents.
267 */
268 public Rect getGivenContentInsetsLw();
269
270 /**
271 * Retrieve the insets given by this window's client for the visible
272 * area of windows behind it. Must be called with the
273 * window manager lock held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700274 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275 * @return Rect The left, top, right, and bottom insets, relative
276 * to the window's frame, of the actual visible area.
277 */
278 public Rect getGivenVisibleInsetsLw();
279
280 /**
281 * Retrieve the current LayoutParams of the window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700282 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 * @return WindowManager.LayoutParams The window's internal LayoutParams
284 * instance.
285 */
286 public WindowManager.LayoutParams getAttrs();
287
288 /**
Dianne Hackborn73ab6a42011-12-13 11:16:23 -0800289 * Return whether this window needs the menu key shown. Must be called
290 * with window lock held, because it may need to traverse down through
291 * window list to determine the result.
292 * @param bottom The bottom-most window to consider when determining this.
293 */
294 public boolean getNeedsMenuLw(WindowState bottom);
295
296 /**
Dianne Hackborn9a230e02011-10-06 11:51:27 -0700297 * Retrieve the current system UI visibility flags associated with
298 * this window.
299 */
300 public int getSystemUiVisibility();
301
302 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800303 * Get the layer at which this window's surface will be Z-ordered.
304 */
305 public int getSurfaceLayer();
Selim Cinekd6623612015-05-22 18:56:22 -0700306
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 /**
Selim Cinekd6623612015-05-22 18:56:22 -0700308 * Retrieve the type of the top-level window.
309 *
310 * @return the base type of the parent window if attached or its own type otherwise
311 */
312 public int getBaseType();
313
314 /**
315 * Return the token for the application (actually activity) that owns
316 * this window. May return null for system windows.
317 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 * @return An IApplicationToken identifying the owning activity.
319 */
320 public IApplicationToken getAppToken();
321
322 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700323 * Return true if this window is participating in voice interaction.
324 */
325 public boolean isVoiceInteraction();
326
327 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700328 * Return true if, at any point, the application token associated with
329 * this window has actually displayed any windows. This is most useful
330 * with the "starting up" window to determine if any windows were
331 * displayed when it is closed.
332 *
333 * @return Returns true if one or more windows have been displayed,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800334 * else false.
335 */
336 public boolean hasAppShownWindows();
337
338 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800339 * Is this window visible? It is not visible if there is no
340 * surface, or we are in the process of running an exit animation
341 * that will remove the surface.
342 */
343 boolean isVisibleLw();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700344
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700346 * Is this window currently visible to the user on-screen? It is
347 * displayed either if it is visible or it is currently running an
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800348 * animation before no longer being visible. Must be called with the
349 * window manager lock held.
350 */
351 boolean isDisplayedLw();
352
353 /**
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700354 * Return true if this window (or a window it is attached to, but not
355 * considering its app token) is currently animating.
356 */
Filip Gruszczynski14b4e572015-11-03 15:53:55 -0800357 boolean isAnimatingLw();
Dianne Hackborn5c58de32012-04-28 19:52:37 -0700358
359 /**
Jorim Jaggi23cc9aa2017-05-23 16:05:35 +0200360 * @return Whether the window can affect SystemUI flags, meaning that SystemUI (system bars,
361 * for example) will be affected by the flags specified in this window. This is the
362 * case when the surface is on screen but not exiting.
363 */
364 boolean canAffectSystemUiFlags();
365
366 /**
Dianne Hackborn01b02a72012-01-12 14:05:03 -0800367 * Is this window considered to be gone for purposes of layout?
368 */
369 boolean isGoneForLayoutLw();
370
371 /**
Adrian Roos76d2fe42015-07-09 14:54:08 -0700372 * Returns true if the window has a surface that it has drawn a
373 * complete UI in to. Note that this is different from {@link #hasDrawnLw()}
374 * in that it also returns true if the window is READY_TO_SHOW, but was not yet
375 * promoted to HAS_DRAWN.
376 */
377 boolean isDrawnLw();
378
379 /**
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700380 * Returns true if this window has been shown on screen at some time in
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 * the past. Must be called with the window manager lock held.
Jorim Jaggia32da382018-03-28 18:01:22 +0200382 *
383 * @deprecated Use {@link #isDrawnLw} or any of the other drawn/visibility methods.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 */
Jorim Jaggia32da382018-03-28 18:01:22 +0200385 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 public boolean hasDrawnLw();
387
388 /**
389 * Can be called by the policy to force a window to be hidden,
390 * regardless of whether the client or window manager would like
391 * it shown. Must be called with the window manager lock held.
392 * Returns true if {@link #showLw} was last called for the window.
393 */
394 public boolean hideLw(boolean doAnimation);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700395
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 /**
397 * Can be called to undo the effect of {@link #hideLw}, allowing a
398 * window to be shown as long as the window manager and client would
399 * also like it to be shown. Must be called with the window manager
400 * lock held.
401 * Returns true if {@link #hideLw} was last called for the window.
402 */
403 public boolean showLw(boolean doAnimation);
Dianne Hackbornf87d1962012-04-04 12:48:24 -0700404
405 /**
406 * Check whether the process hosting this window is currently alive.
407 */
408 public boolean isAlive();
Craig Mautner69b08182012-09-05 13:07:13 -0700409
410 /**
411 * Check if window is on {@link Display#DEFAULT_DISPLAY}.
412 * @return true if window is on default display.
413 */
414 public boolean isDefaultDisplay();
Adrian Rooscd3884d2015-02-18 17:25:23 +0100415
416 /**
417 * Check whether the window is currently dimming.
418 */
419 public boolean isDimming();
Jorim Jaggi86905582016-02-09 21:36:09 -0800420
Adrian Roos865c70f2018-01-10 17:32:27 +0100421 /**
422 * Returns true if the window is letterboxed for the display cutout.
423 */
424 default boolean isLetterboxedForDisplayCutoutLw() {
425 return false;
426 }
427
Adrian Roos23df3a32018-03-15 15:41:13 +0100428 /**
429 * Returns true if the window has a letterbox and any part of that letterbox overlaps with
430 * the given {@code rect}.
431 */
432 default boolean isLetterboxedOverlappingWith(Rect rect) {
433 return false;
434 }
435
Wale Ogunwale44f036f2017-09-29 05:09:09 -0700436 /** @return the current windowing mode of this window. */
437 int getWindowingMode();
Wale Ogunwale9185fb02016-03-11 18:06:14 -0800438
439 /**
440 * Returns true if the window is current in multi-windowing mode. i.e. it shares the
441 * screen with other application windows.
442 */
Andrii Kulian933076d2016-03-29 17:04:42 -0700443 public boolean isInMultiWindowMode();
Robert Carrfd10cd12016-06-29 16:41:50 -0700444
445 public int getRotationAnimationHint();
Jorim Jaggife762342016-10-13 14:33:27 +0200446
447 public boolean isInputMethodWindow();
448
Robert Carr825581a2018-03-30 14:00:53 -0700449 public boolean isInputMethodTarget();
450
Jorim Jaggife762342016-10-13 14:33:27 +0200451 public int getDisplayId();
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800452
453 /**
454 * Returns true if the window owner can add internal system windows.
Adrian Roose99bc052017-11-20 17:55:31 +0100455 * That is, they have {@link Manifest.permission#INTERNAL_SYSTEM_WINDOW}.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800456 */
457 default boolean canAddInternalSystemWindow() {
458 return false;
459 }
Jorim Jaggif12ec0f2017-08-23 16:14:10 +0200460
461 /**
462 * Returns true if the window owner has the permission to acquire a sleep token when it's
Adrian Roose99bc052017-11-20 17:55:31 +0100463 * visible. That is, they have the permission {@link Manifest.permission#DEVICE_POWER}.
Jorim Jaggif12ec0f2017-08-23 16:14:10 +0200464 */
465 boolean canAcquireSleepToken();
Vishnu Nair9a3e4062018-01-11 08:42:54 -0800466
Tiger Huang513d5e12018-07-16 21:49:50 +0800467 /** @return true if this window desires key events. */
468 boolean canReceiveKeys();
469
Vishnu Nair9a3e4062018-01-11 08:42:54 -0800470 /**
Yi Jin6c6e9ca2018-03-20 16:53:35 -0700471 * Writes {@link com.android.server.wm.IdentifierProto} to stream.
Vishnu Nair9a3e4062018-01-11 08:42:54 -0800472 */
473 void writeIdentifierToProto(ProtoOutputStream proto, long fieldId);
chaviw1454b392018-08-06 09:54:04 -0700474
475 /**
476 * @return The {@link WindowFrames} associated with this {@link WindowState}
477 */
478 WindowFrames getWindowFrames();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800479 }
480
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700481 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700482 * Representation of a input consumer that the policy has added to the
483 * window manager to consume input events going to windows below it.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700484 */
Selim Cinekf83e8242015-05-19 18:08:14 -0700485 public interface InputConsumer {
Dianne Hackborndf89e652011-10-06 22:35:11 -0700486 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700487 * Remove the input consumer from the window manager.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700488 */
489 void dismiss();
490 }
491
492 /**
Jorim Jaggiba41f4b2016-12-14 17:43:07 -0800493 * Holds the contents of a starting window. {@link #addSplashScreen} needs to wrap the
494 * contents of the starting window into an class implementing this interface, which then will be
Jorim Jaggi02886a82016-12-06 09:10:06 -0800495 * held by WM and released with {@link #remove} when no longer needed.
Jorim Jaggiba41f4b2016-12-14 17:43:07 -0800496 */
497 interface StartingSurface {
Jorim Jaggi02886a82016-12-06 09:10:06 -0800498
499 /**
500 * Removes the starting window surface. Do not hold the window manager lock when calling
501 * this method!
502 */
503 void remove();
Jorim Jaggiba41f4b2016-12-14 17:43:07 -0800504 }
505
506 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700507 * Interface for calling back in to the window manager that is private
508 * between it and the policy.
509 */
510 public interface WindowManagerFuncs {
Jeff Brownac143512012-04-05 18:57:33 -0700511 public static final int LID_ABSENT = -1;
512 public static final int LID_CLOSED = 0;
513 public static final int LID_OPEN = 1;
514
Michael Wright3818c922014-09-02 13:59:07 -0700515 public static final int CAMERA_LENS_COVER_ABSENT = -1;
516 public static final int CAMERA_LENS_UNCOVERED = 0;
517 public static final int CAMERA_LENS_COVERED = 1;
518
Dianne Hackborndf89e652011-10-06 22:35:11 -0700519 /**
520 * Ask the window manager to re-evaluate the system UI flags.
521 */
522 public void reevaluateStatusBarVisibility();
523
524 /**
Selim Cinekf83e8242015-05-19 18:08:14 -0700525 * Add a input consumer which will consume all input events going to any window below it.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700526 */
Winson41275482016-10-10 15:17:45 -0700527 public InputConsumer createInputConsumer(Looper looper, String name,
Arthur Hung95b38a92018-07-20 18:56:12 +0800528 InputEventReceiver.Factory inputEventReceiverFactory, int displayId);
Jeff Brownac143512012-04-05 18:57:33 -0700529
530 /**
531 * Returns a code that describes the current state of the lid switch.
532 */
533 public int getLidState();
534
535 /**
Edward Savage-Jones7def60d2015-11-13 13:27:03 +0100536 * Lock the device now.
537 */
538 public void lockDeviceNow();
539
540 /**
Michael Wright3818c922014-09-02 13:59:07 -0700541 * Returns a code that descripbes whether the camera lens is covered or not.
542 */
543 public int getCameraLensCoverState();
544
545 /**
Yohei Yukawa2d9accb2018-03-07 19:15:15 -0800546 * Switch the keyboard layout for the given device.
547 * Direction should be +1 or -1 to go to the next or previous keyboard layout.
548 */
549 public void switchKeyboardLayout(int deviceId, int direction);
550
Jeff Brown9a538ee2012-08-20 14:56:57 -0700551 public void shutdown(boolean confirm);
Alison Cichowlasf8eca402016-08-05 14:50:27 -0400552 public void reboot(boolean confirm);
Jeff Brown9a538ee2012-08-20 14:56:57 -0700553 public void rebootSafeMode(boolean confirm);
John Spurlock04db1762013-05-13 12:46:41 -0400554
555 /**
556 * Return the window manager lock needed to correctly call "Lw" methods.
557 */
558 public Object getWindowManagerLock();
Craig Mautner037aa8d2013-06-07 10:35:44 -0700559
560 /** Register a system listener for touch events */
561 void registerPointerEventListener(PointerEventListener listener);
562
563 /** Unregister a system listener for touch events */
564 void unregisterPointerEventListener(PointerEventListener listener);
Jorim Jaggi81ba11e2016-02-03 22:04:22 -0800565
566 /**
567 * @return The content insets of the docked divider window.
568 */
569 int getDockedDividerInsetsLw();
Jorim Jaggi86905582016-02-09 21:36:09 -0800570
571 /**
Wale Ogunwale68278562017-09-23 17:13:55 -0700572 * Retrieves the {@param outBounds} from the stack matching the {@param windowingMode} and
573 * {@param activityType}.
Jorim Jaggi86905582016-02-09 21:36:09 -0800574 */
Wale Ogunwale68278562017-09-23 17:13:55 -0700575 void getStackBounds(int windowingMode, int activityType, Rect outBounds);
Jorim Jaggi77e10432016-10-26 17:43:56 -0700576
577 /**
578 * Notifies window manager that {@link #isShowingDreamLw} has changed.
579 */
580 void notifyShowingDreamChanged();
Jorim Jaggie69c9312016-10-31 18:24:38 -0700581
582 /**
Jorim Jaggi40db0292016-06-27 17:58:03 -0700583 * @return The currently active input method window.
584 */
585 WindowState getInputMethodWindowLw();
586
587 /**
Jorim Jaggie69c9312016-10-31 18:24:38 -0700588 * Notifies window manager that {@link #isKeyguardTrustedLw} has changed.
589 */
590 void notifyKeyguardTrustedChanged();
Jorim Jaggi51304d72017-05-17 17:25:32 +0200591
592 /**
593 * Notifies the window manager that screen is being turned off.
594 *
595 * @param listener callback to call when display can be turned off
596 */
597 void screenTurningOff(ScreenOffListener listener);
Michael Wright19859762017-09-18 20:57:58 +0100598
599 /**
600 * Convert the lid state to a human readable format.
601 */
602 static String lidStateToString(int lid) {
603 switch (lid) {
604 case LID_ABSENT:
605 return "LID_ABSENT";
606 case LID_CLOSED:
607 return "LID_CLOSED";
608 case LID_OPEN:
609 return "LID_OPEN";
610 default:
611 return Integer.toString(lid);
612 }
613 }
614
615 /**
616 * Convert the camera lens state to a human readable format.
617 */
618 static String cameraLensStateToString(int lens) {
619 switch (lens) {
620 case CAMERA_LENS_COVER_ABSENT:
621 return "CAMERA_LENS_COVER_ABSENT";
622 case CAMERA_LENS_UNCOVERED:
623 return "CAMERA_LENS_UNCOVERED";
624 case CAMERA_LENS_COVERED:
625 return "CAMERA_LENS_COVERED";
626 default:
627 return Integer.toString(lens);
628 }
629 }
Adrian Roos842e7882018-03-26 17:34:06 +0200630
631 /**
632 * Hint to window manager that the user has started a navigation action that should
633 * abort animations that have no timeout, in case they got stuck.
634 */
635 void triggerAnimationFailsafe();
Adrian Roos4163d622018-05-22 16:56:35 +0200636
637 /**
638 * The keyguard showing state has changed
639 */
640 void onKeyguardShowingAndNotOccludedChanged();
Riddle Hsuad256a12018-07-18 16:11:30 +0800641
642 DisplayContentInfo getDefaultDisplayContentInfo();
643 }
644
645 /**
646 * Provides the rotation of a device.
647 *
648 * @see com.android.server.policy.WindowOrientationListener
649 */
650 public interface RotationSource {
651 int getProposedRotation();
652
653 void setCurrentRotation(int rotation);
654 }
655
656 /**
657 * Interface to get public information of a display content.
658 */
659 public interface DisplayContentInfo {
660 DisplayRotation getDisplayRotation();
661 Display getDisplay();
Craig Mautner037aa8d2013-06-07 10:35:44 -0700662 }
663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800664 /** Window has been added to the screen. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800665 public static final int TRANSIT_ENTER = 1;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800666 /** Window has been removed from the screen. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800667 public static final int TRANSIT_EXIT = 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 /** Window has been made visible. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800669 public static final int TRANSIT_SHOW = 3;
670 /** Window has been made invisible.
671 * TODO: Consider removal as this is unused. */
672 public static final int TRANSIT_HIDE = 4;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800673 /** The "application starting" preview window is no longer needed, and will
674 * animate away to show the real window. */
Craig Mautner4b71aa12012-12-27 17:20:01 -0800675 public static final int TRANSIT_PREVIEW_DONE = 5;
676
Dianne Hackborn254cb442010-01-27 19:23:59 -0800677 // NOTE: screen off reasons are in order of significance, with more
678 // important ones lower than less important ones.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700679
Tor Norbyed9273d62013-05-30 15:59:53 -0700680 /** @hide */
681 @IntDef({USER_ROTATION_FREE, USER_ROTATION_LOCKED})
682 @Retention(RetentionPolicy.SOURCE)
683 public @interface UserRotationMode {}
684
Daniel Sandlerb73617d2010-08-17 00:41:00 -0400685 /** When not otherwise specified by the activity's screenOrientation, rotation should be
686 * determined by the system (that is, using sensors). */
687 public final int USER_ROTATION_FREE = 0;
688 /** When not otherwise specified by the activity's screenOrientation, rotation is set by
689 * the user. */
690 public final int USER_ROTATION_LOCKED = 1;
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700691
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800692 /**
Riddle Hsu5ce4bb32018-07-18 16:11:30 +0800693 * Set the default display content to provide basic functions for the policy.
694 */
695 public void setDefaultDisplay(DisplayContentInfo displayContentInfo);
696
697 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 * Perform initialization of the policy.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700699 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800700 * @param context The system context we are running in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 */
702 public void init(Context context, IWindowManager windowManager,
Jeff Brown96307042012-07-27 15:51:34 -0700703 WindowManagerFuncs windowManagerFuncs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704
705 /**
706 * Check permissions when adding a window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700707 *
Dianne Hackbornc2293022013-02-06 23:14:49 -0800708 * @param attrs The window's LayoutParams.
709 * @param outAppOp First element will be filled with the app op corresponding to
710 * this window, or OP_NONE.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700711 *
Jeff Brown98365d72012-08-19 20:30:52 -0700712 * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800713 * else an error code, usually
Jeff Brown98365d72012-08-19 20:30:52 -0700714 * {@link WindowManagerGlobal#ADD_PERMISSION_DENIED}, to abort the add.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800715 */
Dianne Hackbornc2293022013-02-06 23:14:49 -0800716 public int checkAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717
718 /**
Craig Mautner88400d32012-09-30 12:35:45 -0700719 * Check permissions when adding a window.
720 *
721 * @param attrs The window's LayoutParams.
722 *
723 * @return True if the window may only be shown to the current user, false if the window can
724 * be shown on all users' windows.
725 */
726 public boolean checkShowToOwnerOnly(WindowManager.LayoutParams attrs);
727
728 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 * Sanitize the layout parameters coming from a client. Allows the policy
730 * to do things like ensure that windows of a specific type can't take
731 * input focus.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700732 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800733 * @param attrs The window layout parameters to be modified. These values
734 * are modified in-place.
735 */
Wale Ogunwalec0b0f932017-11-01 12:51:43 -0700736 public void adjustWindowParamsLw(WindowState win, WindowManager.LayoutParams attrs,
737 boolean hasStatusBarServicePermission);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700738
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800739 /**
740 * After the window manager has computed the current configuration based
741 * on its knowledge of the display and input devices, it gives the policy
742 * a chance to adjust the information contained in it. If you want to
743 * leave it as-is, simply do nothing.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700744 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 * <p>This method may be called by any thread in the window manager, but
746 * no internal locks in the window manager will be held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700747 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800748 * @param config The Configuration being computed, for you to change as
749 * desired.
Jeff Browndaa37532012-05-01 15:54:03 -0700750 * @param keyboardPresence Flags that indicate whether internal or external
751 * keyboards are present.
752 * @param navigationPresence Flags that indicate whether internal or external
753 * navigation devices are present.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800754 */
Jeff Browndaa37532012-05-01 15:54:03 -0700755 public void adjustConfigurationLw(Configuration config, int keyboardPresence,
756 int navigationPresence);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700757
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800758 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800759 * Returns the layer assignment for the window state. Allows you to control how different
760 * kinds of windows are ordered on-screen.
761 *
762 * @param win The window state
763 * @return int An arbitrary integer used to order windows, with lower numbers below higher ones.
764 */
765 default int getWindowLayerLw(WindowState win) {
766 return getWindowLayerFromTypeLw(win.getBaseType(), win.canAddInternalSystemWindow());
767 }
768
769 /**
770 * Returns the layer assignment for the window type. Allows you to control how different
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800771 * kinds of windows are ordered on-screen.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700772 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800773 * @param type The type of window being assigned.
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800774 * @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 -0800775 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800776 default int getWindowLayerFromTypeLw(int type) {
777 if (isSystemAlertWindowType(type)) {
778 throw new IllegalArgumentException("Use getWindowLayerFromTypeLw() or"
779 + " getWindowLayerLw() for alert window types");
780 }
781 return getWindowLayerFromTypeLw(type, false /* canAddInternalSystemWindow */);
782 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800783
784 /**
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800785 * Returns the layer assignment for the window type. Allows you to control how different
786 * kinds of windows are ordered on-screen.
787 *
788 * @param type The type of window being assigned.
789 * @param canAddInternalSystemWindow If the owner window associated with the type we are
790 * evaluating can add internal system windows. I.e they have
Adrian Roose99bc052017-11-20 17:55:31 +0100791 * {@link Manifest.permission#INTERNAL_SYSTEM_WINDOW}. If true, alert window
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800792 * types {@link android.view.WindowManager.LayoutParams#isSystemAlertWindowType(int)}
793 * can be assigned layers greater than the layer for
794 * {@link android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY} Else, their
795 * layers would be lesser.
796 * @return int An arbitrary integer used to order windows, with lower numbers below higher ones.
797 */
798 default int getWindowLayerFromTypeLw(int type, boolean canAddInternalSystemWindow) {
799 if (type >= FIRST_APPLICATION_WINDOW && type <= LAST_APPLICATION_WINDOW) {
800 return APPLICATION_LAYER;
801 }
802
803 switch (type) {
804 case TYPE_WALLPAPER:
805 // wallpaper is at the bottom, though the window manager may move it.
806 return 1;
807 case TYPE_PRESENTATION:
808 case TYPE_PRIVATE_PRESENTATION:
809 return APPLICATION_LAYER;
810 case TYPE_DOCK_DIVIDER:
811 return APPLICATION_LAYER;
812 case TYPE_QS_DIALOG:
813 return APPLICATION_LAYER;
814 case TYPE_PHONE:
815 return 3;
816 case TYPE_SEARCH_BAR:
817 case TYPE_VOICE_INTERACTION_STARTING:
818 return 4;
819 case TYPE_VOICE_INTERACTION:
820 // voice interaction layer is almost immediately above apps.
821 return 5;
822 case TYPE_INPUT_CONSUMER:
823 return 6;
824 case TYPE_SYSTEM_DIALOG:
825 return 7;
826 case TYPE_TOAST:
827 // toasts and the plugged-in battery thing
828 return 8;
829 case TYPE_PRIORITY_PHONE:
830 // SIM errors and unlock. Not sure if this really should be in a high layer.
831 return 9;
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800832 case TYPE_SYSTEM_ALERT:
833 // like the ANR / app crashed dialogs
834 return canAddInternalSystemWindow ? 11 : 10;
835 case TYPE_APPLICATION_OVERLAY:
Wale Ogunwaled993a572017-02-05 13:52:09 -0800836 return 12;
837 case TYPE_DREAM:
838 // used for Dreams (screensavers with TYPE_DREAM windows)
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800839 return 13;
840 case TYPE_INPUT_METHOD:
841 // on-screen keyboards and other such input method user interfaces go here.
842 return 14;
843 case TYPE_INPUT_METHOD_DIALOG:
844 // on-screen keyboards and other such input method user interfaces go here.
845 return 15;
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800846 case TYPE_STATUS_BAR:
Robert Carr8360a782017-11-22 12:47:58 -0800847 return 17;
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800848 case TYPE_STATUS_BAR_PANEL:
Robert Carr8360a782017-11-22 12:47:58 -0800849 return 18;
850 case TYPE_STATUS_BAR_SUB_PANEL:
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800851 return 19;
852 case TYPE_KEYGUARD_DIALOG:
853 return 20;
854 case TYPE_VOLUME_OVERLAY:
855 // the on-screen volume indicator and controller shown when the user
856 // changes the device volume
857 return 21;
858 case TYPE_SYSTEM_OVERLAY:
859 // the on-screen volume indicator and controller shown when the user
860 // changes the device volume
861 return canAddInternalSystemWindow ? 22 : 11;
862 case TYPE_NAVIGATION_BAR:
863 // the navigation bar, if available, shows atop most things
864 return 23;
865 case TYPE_NAVIGATION_BAR_PANEL:
866 // some panels (e.g. search) need to show on top of the navigation bar
867 return 24;
868 case TYPE_SCREENSHOT:
869 // screenshot selection layer shouldn't go above system error, but it should cover
870 // navigation bars at the very least.
871 return 25;
872 case TYPE_SYSTEM_ERROR:
873 // system-level error dialogs
874 return canAddInternalSystemWindow ? 26 : 10;
875 case TYPE_MAGNIFICATION_OVERLAY:
876 // used to highlight the magnified portion of a display
877 return 27;
878 case TYPE_DISPLAY_OVERLAY:
879 // used to simulate secondary display devices
880 return 28;
881 case TYPE_DRAG:
882 // the drag layer: input for drag-and-drop is associated with this window,
883 // which sits above all other focusable windows
884 return 29;
885 case TYPE_ACCESSIBILITY_OVERLAY:
886 // overlay put by accessibility services to intercept user interaction
887 return 30;
888 case TYPE_SECURE_SYSTEM_OVERLAY:
889 return 31;
890 case TYPE_BOOT_PROGRESS:
891 return 32;
892 case TYPE_POINTER:
893 // the (mouse) pointer layer
894 return 33;
895 default:
896 Slog.e("WindowManager", "Unknown window type: " + type);
897 return APPLICATION_LAYER;
898 }
899 }
900
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800901 /**
902 * Return how to Z-order sub-windows in relation to the window they are attached to.
903 * Return positive to have them ordered in front, negative for behind.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700904 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905 * @param type The sub-window type code.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700906 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800907 * @return int Layer in relation to the attached window, where positive is
908 * above and negative is below.
909 */
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800910 default int getSubWindowLayerFromTypeLw(int type) {
911 switch (type) {
912 case TYPE_APPLICATION_PANEL:
913 case TYPE_APPLICATION_ATTACHED_DIALOG:
914 return APPLICATION_PANEL_SUBLAYER;
915 case TYPE_APPLICATION_MEDIA:
916 return APPLICATION_MEDIA_SUBLAYER;
917 case TYPE_APPLICATION_MEDIA_OVERLAY:
918 return APPLICATION_MEDIA_OVERLAY_SUBLAYER;
919 case TYPE_APPLICATION_SUB_PANEL:
920 return APPLICATION_SUB_PANEL_SUBLAYER;
921 case TYPE_APPLICATION_ABOVE_SUB_PANEL:
922 return APPLICATION_ABOVE_SUB_PANEL_SUBLAYER;
923 }
924 Slog.e("WindowManager", "Unknown sub-window type: " + type);
925 return 0;
926 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800927
928 /**
Dianne Hackborn6136b7e2009-09-18 01:53:49 -0700929 * Get the highest layer (actually one more than) that the wallpaper is
930 * allowed to be in.
931 */
932 public int getMaxWallpaperLayer();
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700933
934 /**
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700935 * Return the display width available after excluding any screen
Jorim Jaggi82c9dc92016-02-05 15:10:33 -0800936 * decorations that could never be removed in Honeycomb. That is, system bar or
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700937 * button bar.
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400938 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800939 public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation,
Adrian Roos11c25582018-02-19 18:06:36 +0100940 int uiMode, int displayId, DisplayCutout displayCutout);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400941
942 /**
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700943 * Return the display height available after excluding any screen
Jorim Jaggi82c9dc92016-02-05 15:10:33 -0800944 * decorations that could never be removed in Honeycomb. That is, system bar or
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700945 * button bar.
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400946 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800947 public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation,
Adrian Roos11c25582018-02-19 18:06:36 +0100948 int uiMode, int displayId, DisplayCutout displayCutout);
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700949
950 /**
951 * Return the available screen width that we should report for the
952 * configuration. This must be no larger than
Adrian Roos11c25582018-02-19 18:06:36 +0100953 * {@link #getNonDecorDisplayWidth(int, int, int, int, int, DisplayCutout)}; it may be smaller
954 * than that to account for more transient decoration like a status bar.
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700955 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800956 public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation,
Adrian Roos11c25582018-02-19 18:06:36 +0100957 int uiMode, int displayId, DisplayCutout displayCutout);
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700958
959 /**
960 * Return the available screen height that we should report for the
961 * configuration. This must be no larger than
Adrian Roos11c25582018-02-19 18:06:36 +0100962 * {@link #getNonDecorDisplayHeight(int, int, int, int, int, DisplayCutout)}; it may be smaller
963 * than that to account for more transient decoration like a status bar.
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700964 */
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -0800965 public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation,
Adrian Roos11c25582018-02-19 18:06:36 +0100966 int uiMode, int displayId, DisplayCutout displayCutout);
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400967
968 /**
Jorim Jaggife762342016-10-13 14:33:27 +0200969 * Return whether the given window can become the Keyguard window. Typically returns true for
970 * the StatusBar.
Jorim Jaggi0d674622014-05-21 01:34:15 +0200971 */
972 public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs);
973
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700974 /**
Jorim Jaggife762342016-10-13 14:33:27 +0200975 * @return whether {@param win} can be hidden by Keyguard
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700976 */
Jorim Jaggife762342016-10-13 14:33:27 +0200977 public boolean canBeHiddenByKeyguardLw(WindowState win);
Craig Mautner7d7808f2014-09-11 18:02:38 -0700978
979 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800980 * Called when the system would like to show a UI to indicate that an
981 * application is starting. You can use this to add a
982 * APPLICATION_STARTING_TYPE window with the given appToken to the window
983 * manager (using the normal window manager APIs) that will be shown until
984 * the application displays its own window. This is called without the
985 * window manager locked so that you can call back into it.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700986 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800987 * @param appToken Token of the application being started.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700988 * @param packageName The name of the application package being started.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800989 * @param theme Resource defining the application's overall visual theme.
990 * @param nonLocalizedLabel The default title label of the application if
991 * no data is found in the resource.
992 * @param labelRes The resource ID the application would like to use as its name.
993 * @param icon The resource ID the application would like to use as its icon.
Dianne Hackborn7eec10e2010-11-12 18:03:47 -0800994 * @param windowFlags Window layout flags.
Wale Ogunwaledfc18622016-04-16 15:08:48 -0700995 * @param overrideConfig override configuration to consider when generating
996 * context to for resources.
Andrii Kulianfb1bf692017-01-17 11:17:34 -0800997 * @param displayId Id of the display to show the splash screen at.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700998 *
Jorim Jaggi02886a82016-12-06 09:10:06 -0800999 * @return The starting surface.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001000 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 */
Jorim Jaggiba41f4b2016-12-14 17:43:07 -08001002 public StartingSurface addSplashScreen(IBinder appToken, String packageName, int theme,
1003 CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon,
Andrii Kulianfb1bf692017-01-17 11:17:34 -08001004 int logo, int windowFlags, Configuration overrideConfig, int displayId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001005
1006 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001007 * Prepare for a window being added to the window manager. You can throw an
1008 * exception here to prevent the window being added, or do whatever setup
1009 * you need to keep track of the window.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001010 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001011 * @param win The window being added.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001012 * @param attrs The window's LayoutParams.
1013 *
Jeff Brown98365d72012-08-19 20:30:52 -07001014 * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed, else an
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 * error code to abort the add.
1016 */
1017 public int prepareAddWindowLw(WindowState win,
1018 WindowManager.LayoutParams attrs);
1019
1020 /**
1021 * Called when a window is being removed from a window manager. Must not
1022 * throw an exception -- clean up as much as possible.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001023 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001024 * @param win The window being removed.
1025 */
1026 public void removeWindowLw(WindowState win);
1027
1028 /**
1029 * Control the animation to run when a window's state changes. Return a
1030 * non-0 number to force the animation to a specific resource ID, or 0
1031 * to use the default animation.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001032 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001033 * @param win The window that is changing.
1034 * @param transit What is happening to the window: {@link #TRANSIT_ENTER},
1035 * {@link #TRANSIT_EXIT}, {@link #TRANSIT_SHOW}, or
1036 * {@link #TRANSIT_HIDE}.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001037 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001038 * @return Resource ID of the actual animation to use, or 0 for none.
1039 */
1040 public int selectAnimationLw(WindowState win, int transit);
1041
1042 /**
Craig Mautner3c174372013-02-21 17:54:37 -08001043 * Determine the animation to run for a rotation transition based on the
1044 * top fullscreen windows {@link WindowManager.LayoutParams#rotationAnimation}
1045 * and whether it is currently fullscreen and frontmost.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001046 *
1047 * @param anim The exiting animation resource id is stored in anim[0], the
Craig Mautner3c174372013-02-21 17:54:37 -08001048 * entering animation resource id is stored in anim[1].
1049 */
1050 public void selectRotationAnimationLw(int anim[]);
1051
1052 /**
1053 * Validate whether the current top fullscreen has specified the same
1054 * {@link WindowManager.LayoutParams#rotationAnimation} value as that
1055 * being passed in from the previous top fullscreen window.
1056 *
1057 * @param exitAnimId exiting resource id from the previous window.
1058 * @param enterAnimId entering resource id from the previous window.
1059 * @param forceDefault For rotation animations only, if true ignore the
1060 * animation values and just return false.
1061 * @return true if the previous values are still valid, false if they
1062 * should be replaced with the default.
1063 */
1064 public boolean validateRotationAnimationLw(int exitAnimId, int enterAnimId,
1065 boolean forceDefault);
1066
1067 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001068 * Create and return an animation to re-display a window that was force hidden by Keyguard.
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001069 */
Jorim Jaggife762342016-10-13 14:33:27 +02001070 public Animation createHiddenByKeyguardExit(boolean onWallpaper,
Jorim Jaggi84a3e7a2014-08-13 17:58:58 +02001071 boolean goingToNotificationShade);
Jorim Jaggi76a16232014-08-08 17:00:47 +02001072
1073 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001074 * Create and return an animation to let the wallpaper disappear after being shown behind
1075 * Keyguard.
Jorim Jaggi76a16232014-08-08 17:00:47 +02001076 */
Jorim Jaggife762342016-10-13 14:33:27 +02001077 public Animation createKeyguardWallpaperExit(boolean goingToNotificationShade);
Jorim Jaggi76a16232014-08-08 17:00:47 +02001078
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001079 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001080 * Called from the input reader thread before a key is enqueued.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 *
1082 * <p>There are some actions that need to be handled here because they
1083 * affect the power state of the device, for example, the power keys.
1084 * Generally, it's best to keep as little as possible in the queue thread
1085 * because it's the most fragile.
Jeff Brown1f245102010-11-18 20:53:46 -08001086 * @param event The key event.
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001087 * @param policyFlags The policy flags associated with the key.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001088 *
Jeff Brown26875502014-01-30 21:47:47 -08001089 * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001090 */
Jeff Brown037c33e2014-04-09 00:31:55 -07001091 public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags);
Jeff Brown56194eb2011-03-02 19:23:13 -08001092
1093 /**
Michael Wright70af00a2014-09-03 19:30:20 -07001094 * Called from the input reader thread before a motion is enqueued when the device is in a
1095 * non-interactive state.
Jeff Brown56194eb2011-03-02 19:23:13 -08001096 *
1097 * <p>There are some actions that need to be handled here because they
1098 * affect the power state of the device, for example, waking on motions.
1099 * Generally, it's best to keep as little as possible in the queue thread
1100 * because it's the most fragile.
1101 * @param policyFlags The policy flags associated with the motion.
1102 *
Jeff Brown26875502014-01-30 21:47:47 -08001103 * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
Jeff Brown56194eb2011-03-02 19:23:13 -08001104 */
Michael Wright70af00a2014-09-03 19:30:20 -07001105 public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags);
Jeff Brown56194eb2011-03-02 19:23:13 -08001106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001107 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001108 * Called from the input dispatcher thread before a key is dispatched to a window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001109 *
1110 * <p>Allows you to define
Jeff Brown3915bb82010-11-05 15:02:16 -07001111 * behavior for keys that can not be overridden by applications.
1112 * This method is called from the input thread, with no locks held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001113 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001114 * @param win The window that currently has focus. This is where the key
1115 * event will normally go.
Jeff Brown1f245102010-11-18 20:53:46 -08001116 * @param event The key event.
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001117 * @param policyFlags The policy flags associated with the key.
Jeff Brownd5bb82d2011-10-12 13:57:59 -07001118 * @return 0 if the key should be dispatched immediately, -1 if the key should
1119 * not be dispatched ever, or a positive value indicating the number of
1120 * milliseconds by which the key dispatch should be delayed before trying
1121 * again.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 */
Jeff Brownd5bb82d2011-10-12 13:57:59 -07001123 public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001124
1125 /**
Jeff Brown3915bb82010-11-05 15:02:16 -07001126 * Called from the input dispatcher thread when an application did not handle
1127 * a key that was dispatched to it.
1128 *
1129 * <p>Allows you to define default global behavior for keys that were not handled
1130 * by applications. This method is called from the input thread, with no locks held.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001131 *
Jeff Brown3915bb82010-11-05 15:02:16 -07001132 * @param win The window that currently has focus. This is where the key
1133 * event will normally go.
Jeff Brown1f245102010-11-18 20:53:46 -08001134 * @param event The key event.
Jeff Brown3915bb82010-11-05 15:02:16 -07001135 * @param policyFlags The policy flags associated with the key.
Jeff Brown49ed71d2010-12-06 17:13:33 -08001136 * @return Returns an alternate key event to redispatch as a fallback, or null to give up.
1137 * The caller is responsible for recycling the key event.
Jeff Brown3915bb82010-11-05 15:02:16 -07001138 */
Jeff Brown49ed71d2010-12-06 17:13:33 -08001139 public KeyEvent dispatchUnhandledKey(WindowState win, KeyEvent event, int policyFlags);
Jeff Brown3915bb82010-11-05 15:02:16 -07001140
1141 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001142 * Called when layout of the windows is about to start.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001143 *
Wale Ogunwale828ff7e2017-11-14 01:01:29 +00001144 * @param displayFrames frames of the display we are doing layout on.
Sriram Viswanathan9ebbe6a2015-11-16 17:59:22 -08001145 * @param uiMode The current uiMode in configuration.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001146 */
Wale Ogunwale828ff7e2017-11-14 01:01:29 +00001147 default void beginLayoutLw(DisplayFrames displayFrames, int uiMode) {}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001148
1149 /**
John Spurlock46646232013-09-30 22:32:42 -04001150 * Returns the bottom-most layer of the system decor, above which no policy decor should
1151 * be applied.
Dianne Hackborn85afd1b2012-05-13 13:31:06 -07001152 */
John Spurlock46646232013-09-30 22:32:42 -04001153 public int getSystemDecorLayerLw();
Dianne Hackborn85afd1b2012-05-13 13:31:06 -07001154
1155 /**
Wale Ogunwale828ff7e2017-11-14 01:01:29 +00001156 * Called for each window attached to the window manager as layout is proceeding. The
1157 * implementation of this function must take care of setting the window's frame, either here or
1158 * in finishLayout().
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001159 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001160 * @param win The window being positioned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 * @param attached For sub-windows, the window it is attached to; this
1162 * window will already have had layoutWindow() called on it
1163 * so you can use its Rect. Otherwise null.
Wale Ogunwale828ff7e2017-11-14 01:01:29 +00001164 * @param displayFrames The display frames.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001165 */
Wale Ogunwale828ff7e2017-11-14 01:01:29 +00001166 default void layoutWindowLw(
1167 WindowState win, WindowState attached, DisplayFrames displayFrames) {}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001168
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001169 /**
Adrian Roos9e370f22018-03-06 18:19:45 +01001170 * Return the layout hints for a newly added window. These values are computed on the
Wale Ogunwale828ff7e2017-11-14 01:01:29 +00001171 * most recent layout, so they are not guaranteed to be correct.
Adrian Roos37d7a682014-11-06 18:15:16 +01001172 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 * @param attrs The LayoutParams of the window.
Jorim Jaggi23bf5462016-05-13 15:24:39 -07001174 * @param taskBounds The bounds of the task this window is on or {@code null} if no task is
1175 * associated with the window.
Wale Ogunwale828ff7e2017-11-14 01:01:29 +00001176 * @param displayFrames display frames.
Adrian Roos51311812018-07-03 15:35:33 +02001177 * @param floatingStack Whether the window's stack is floating.
Adrian Roos9e370f22018-03-06 18:19:45 +01001178 * @param outFrame The frame of the window.
Adrian Roos37d7a682014-11-06 18:15:16 +01001179 * @param outContentInsets The areas covered by system windows, expressed as positive insets.
1180 * @param outStableInsets The areas covered by stable system windows irrespective of their
1181 * current visibility. Expressed as positive insets.
Filip Gruszczynski0ec13282015-06-25 11:26:01 -07001182 * @param outOutsets The areas that are not real display, but we would like to treat as such.
Adrian Roos5c6b6222017-11-07 17:36:10 +01001183 * @param outDisplayCutout The area that has been cut away from the display.
Jorim Jaggi0ffd49c2016-02-12 15:04:21 -08001184 * @return Whether to always consume the navigation bar.
1185 * See {@link #isNavBarForcedShownLw(WindowState)}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 */
Adrian Roos9e370f22018-03-06 18:19:45 +01001187 default boolean getLayoutHintLw(WindowManager.LayoutParams attrs, Rect taskBounds,
Adrian Roos51311812018-07-03 15:35:33 +02001188 DisplayFrames displayFrames, boolean floatingStack,
1189 Rect outFrame, Rect outContentInsets, Rect outStableInsets, Rect outOutsets,
Adrian Roos9e370f22018-03-06 18:19:45 +01001190 DisplayCutout.ParcelableWrapper outDisplayCutout) {
Wale Ogunwale828ff7e2017-11-14 01:01:29 +00001191 return false;
1192 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001193
1194 /**
Craig Mautner39834192012-09-02 07:47:24 -07001195 * Called following layout of all windows before each window has policy applied.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001196 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001197 * @param displayWidth The current full width of the screen.
1198 * @param displayHeight The current full height of the screen.
1199 */
Craig Mautner39834192012-09-02 07:47:24 -07001200 public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001201
1202 /**
Craig Mautner39834192012-09-02 07:47:24 -07001203 * Called following layout of all window to apply policy to each window.
Yohei Yukawad1a09222015-06-30 16:22:05 -07001204 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001205 * @param win The window being positioned.
Yohei Yukawad1a09222015-06-30 16:22:05 -07001206 * @param attrs The LayoutParams of the window.
1207 * @param attached For sub-windows, the window it is attached to. Otherwise null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001208 */
Craig Mautner39834192012-09-02 07:47:24 -07001209 public void applyPostLayoutPolicyLw(WindowState win,
Jorim Jaggife762342016-10-13 14:33:27 +02001210 WindowManager.LayoutParams attrs, WindowState attached, WindowState imeTarget);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001211
1212 /**
Craig Mautner39834192012-09-02 07:47:24 -07001213 * Called following layout of all windows and after policy has been applied
1214 * to each window. If in this function you do
1215 * something that may have modified the animation state of another window,
1216 * be sure to return non-zero in order to perform another pass through layout.
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001217 *
Dianne Hackbornb8b11a02010-03-10 15:53:11 -08001218 * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT},
1219 * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER},
1220 * or {@link #FINISH_LAYOUT_REDO_ANIM}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001221 */
Craig Mautner39834192012-09-02 07:47:24 -07001222 public int finishPostLayoutPolicyLw();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223
1224 /**
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001225 * Return true if it is okay to perform animations for an app transition
Jorim Jaggif84e2f62018-01-16 14:17:59 +01001226 * that is about to occur. You may return false for this if, for example,
1227 * the dream window is currently displayed so the switch should happen
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001228 * immediately.
1229 */
1230 public boolean allowAppAnimationsLw();
Joe Onorato664644d2011-01-23 17:53:23 -08001231
Joe Onorato664644d2011-01-23 17:53:23 -08001232 /**
1233 * A new window has been focused.
1234 */
Dianne Hackborndf89e652011-10-06 22:35:11 -07001235 public int focusChangedLw(WindowState lastFocus, WindowState newFocus);
Jeff Brown36c4db82014-09-19 12:05:31 -07001236
1237 /**
Jeff Brown416c49c2015-05-26 19:50:18 -07001238 * Called when the device has started waking up.
Jeff Brown36c4db82014-09-19 12:05:31 -07001239 */
Jeff Brown416c49c2015-05-26 19:50:18 -07001240 public void startedWakingUp();
Jeff Brown36c4db82014-09-19 12:05:31 -07001241
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001242 /**
Jeff Brown416c49c2015-05-26 19:50:18 -07001243 * Called when the device has finished waking up.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001244 */
Jeff Brown416c49c2015-05-26 19:50:18 -07001245 public void finishedWakingUp();
1246
1247 /**
1248 * Called when the device has started going to sleep.
1249 *
1250 * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN},
1251 * or {@link #OFF_BECAUSE_OF_TIMEOUT}.
1252 */
1253 public void startedGoingToSleep(int why);
1254
1255 /**
1256 * Called when the device has finished going to sleep.
1257 *
1258 * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN},
1259 * or {@link #OFF_BECAUSE_OF_TIMEOUT}.
1260 */
1261 public void finishedGoingToSleep(int why);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001262
Jeff Brown36c4db82014-09-19 12:05:31 -07001263 /**
1264 * Called when the device is about to turn on the screen to show content.
1265 * When waking up, this method will be called once after the call to wakingUp().
1266 * When dozing, the method will be called sometime after the call to goingToSleep() and
1267 * may be called repeatedly in the case where the screen is pulsing on and off.
1268 *
1269 * Must call back on the listener to tell it when the higher-level system
1270 * is ready for the screen to go on (i.e. the lock screen is shown).
1271 */
1272 public void screenTurningOn(ScreenOnListener screenOnListener);
1273
Jeff Brown3ee549c2014-09-22 20:14:39 -07001274 /**
Jorim Jaggi0d210f62015-07-10 14:24:44 -07001275 * Called when the device has actually turned on the screen, i.e. the display power state has
1276 * been set to ON and the screen is unblocked.
1277 */
1278 public void screenTurnedOn();
1279
1280 /**
Jorim Jaggi51304d72017-05-17 17:25:32 +02001281 * Called when the display would like to be turned off. This gives policy a chance to do some
1282 * things before the display power state is actually changed to off.
1283 *
1284 * @param screenOffListener Must be called to tell that the display power state can actually be
1285 * changed now after policy has done its work.
1286 */
1287 public void screenTurningOff(ScreenOffListener screenOffListener);
1288
1289 /**
Jeff Brown3ee549c2014-09-22 20:14:39 -07001290 * Called when the device has turned the screen off.
1291 */
1292 public void screenTurnedOff();
1293
Dianne Hackborn38e29a62011-09-18 14:43:08 -07001294 public interface ScreenOnListener {
1295 void onScreenOn();
Craig Mautner61ac6bb2012-02-02 17:29:33 -08001296 }
Dianne Hackborn38e29a62011-09-18 14:43:08 -07001297
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001298 /**
Jorim Jaggi51304d72017-05-17 17:25:32 +02001299 * See {@link #screenTurnedOff}
1300 */
1301 public interface ScreenOffListener {
1302 void onScreenOff();
1303 }
1304
1305 /**
Jeff Brown3ee549c2014-09-22 20:14:39 -07001306 * Return whether the default display is on and not blocked by a black surface.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001307 */
Jeff Brown3ee549c2014-09-22 20:14:39 -07001308 public boolean isScreenOn();
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001309
Dianne Hackbornde2606d2009-12-18 16:53:55 -08001310 /**
Adrian Roos7c894802017-07-19 12:25:34 +02001311 * @return whether the device is currently allowed to animate.
Adrian Roose94c15c2017-05-09 13:17:54 -07001312 *
Adrian Roos7c894802017-07-19 12:25:34 +02001313 * Note: this can be true even if it is not appropriate to animate for reasons that are outside
1314 * of the policy's authority.
Adrian Roose94c15c2017-05-09 13:17:54 -07001315 */
Adrian Roos7c894802017-07-19 12:25:34 +02001316 boolean okToAnimate();
Adrian Roose94c15c2017-05-09 13:17:54 -07001317
1318 /**
Jeff Brown00fa7bd2010-07-02 15:37:36 -07001319 * Tell the policy that the lid switch has changed state.
1320 * @param whenNanos The time when the change occurred in uptime nanoseconds.
1321 * @param lidOpen True if the lid is now open.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001322 */
Jeff Brown46b9ac02010-04-22 18:58:52 -07001323 public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen);
Michael Wright3818c922014-09-02 13:59:07 -07001324
1325 /**
1326 * Tell the policy that the camera lens has been covered or uncovered.
1327 * @param whenNanos The time when the change occurred in uptime nanoseconds.
1328 * @param lensCovered True if the lens is covered.
1329 */
1330 public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered);
1331
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001332 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001333 * Tell the policy if anyone is requesting that keyguard not come on.
1334 *
1335 * @param enabled Whether keyguard can be on or not. does not actually
1336 * turn it on, unless it was previously disabled with this function.
1337 *
1338 * @see android.app.KeyguardManager.KeyguardLock#disableKeyguard()
1339 * @see android.app.KeyguardManager.KeyguardLock#reenableKeyguard()
1340 */
Craig Mautner3c174372013-02-21 17:54:37 -08001341 @SuppressWarnings("javadoc")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001342 public void enableKeyguard(boolean enabled);
1343
1344 /**
Adrian Roose99bc052017-11-20 17:55:31 +01001345 * Callback used by {@link #exitKeyguardSecurely}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001346 */
1347 interface OnKeyguardExitResult {
1348 void onKeyguardExitResult(boolean success);
1349 }
1350
1351 /**
1352 * Tell the policy if anyone is requesting the keyguard to exit securely
1353 * (this would be called after the keyguard was disabled)
1354 * @param callback Callback to send the result back.
1355 * @see android.app.KeyguardManager#exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult)
1356 */
Craig Mautner3c174372013-02-21 17:54:37 -08001357 @SuppressWarnings("javadoc")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 void exitKeyguardSecurely(OnKeyguardExitResult callback);
1359
1360 /**
Mike Lockwood520d8bc2011-02-18 13:23:13 -05001361 * isKeyguardLocked
1362 *
1363 * Return whether the keyguard is currently locked.
1364 *
1365 * @return true if in keyguard is locked.
1366 */
1367 public boolean isKeyguardLocked();
1368
1369 /**
1370 * isKeyguardSecure
1371 *
1372 * Return whether the keyguard requires a password to unlock.
Jim Millere4044bb2016-05-10 18:38:25 -07001373 * @param userId
Mike Lockwood520d8bc2011-02-18 13:23:13 -05001374 *
1375 * @return true if in keyguard is secure.
1376 */
Jim Millere4044bb2016-05-10 18:38:25 -07001377 public boolean isKeyguardSecure(int userId);
Mike Lockwood520d8bc2011-02-18 13:23:13 -05001378
1379 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001380 * Return whether the keyguard is currently occluded.
Adrian Roos461829d2015-06-03 14:41:18 -07001381 *
Jorim Jaggife762342016-10-13 14:33:27 +02001382 * @return true if in keyguard is occluded, false otherwise
Adrian Roos461829d2015-06-03 14:41:18 -07001383 */
Jorim Jaggife762342016-10-13 14:33:27 +02001384 public boolean isKeyguardOccluded();
Adrian Roos461829d2015-06-03 14:41:18 -07001385
1386 /**
Tony Mak2c0d6dc2016-04-29 16:16:54 +01001387 * @return true if in keyguard is on and not occluded.
1388 */
1389 public boolean isKeyguardShowingAndNotOccluded();
1390
1391 /**
Jorim Jaggife762342016-10-13 14:33:27 +02001392 * @return whether Keyguard is in trusted state and can be dismissed without credentials
1393 */
1394 public boolean isKeyguardTrustedLw();
1395
1396 /**
Siarhei Vishniakou35fbb312017-12-13 13:48:50 -08001397 * inKeyguardRestrictedKeyInputMode
1398 *
1399 * If keyguard screen is showing or in restricted key input mode (i.e. in
1400 * keyguard password emergency screen). When in such mode, certain keys,
1401 * such as the Home key and the right soft keys, don't work.
1402 *
1403 * @return true if in keyguard restricted input mode.
1404 */
1405 public boolean inKeyguardRestrictedKeyInputMode();
1406
1407 /**
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001408 * Ask the policy to dismiss the keyguard, if it is currently shown.
Jorim Jaggi241ae102016-11-02 21:57:33 -07001409 *
1410 * @param callback Callback to be informed about the result.
Lucas Dupinc80c67e2017-12-04 14:29:10 -08001411 * @param message A message that should be displayed in the keyguard.
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001412 */
Lucas Dupinc80c67e2017-12-04 14:29:10 -08001413 public void dismissKeyguardLw(@Nullable IKeyguardDismissCallback callback,
1414 CharSequence message);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001415
1416 /**
Jorim Jaggicff0acb2014-03-31 16:35:15 +02001417 * Ask the policy whether the Keyguard has drawn. If the Keyguard is disabled, this method
1418 * returns true as soon as we know that Keyguard is disabled.
1419 *
1420 * @return true if the keyguard has drawn.
1421 */
1422 public boolean isKeyguardDrawnLw();
1423
Jorim Jaggi77e10432016-10-26 17:43:56 -07001424 public boolean isShowingDreamLw();
1425
Jorim Jaggicff0acb2014-03-31 16:35:15 +02001426 /**
Jeff Brownac143512012-04-05 18:57:33 -07001427 * Called when the system is mostly done booting to set whether
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001428 * the system should go into safe mode.
1429 */
Jeff Brownac143512012-04-05 18:57:33 -07001430 public void setSafeMode(boolean safeMode);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001431
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001432 /**
1433 * Called when the system is mostly done booting.
1434 */
1435 public void systemReady();
1436
1437 /**
Dianne Hackbornba24e4d2011-09-01 11:17:06 -07001438 * Called when the system is done booting to the point where the
1439 * user can start interacting with it.
1440 */
1441 public void systemBooted();
1442
1443 /**
Dianne Hackborn661cd522011-08-22 00:26:20 -07001444 * Show boot time message to the user.
1445 */
1446 public void showBootMessage(final CharSequence msg, final boolean always);
1447
1448 /**
1449 * Hide the UI for showing boot messages, never to be displayed again.
1450 */
1451 public void hideBootMessages();
1452
1453 /**
Mike Lockwoodef731622010-01-27 17:51:34 -05001454 * Called when userActivity is signalled in the power manager.
1455 * This is safe to call from any thread, with any window manager locks held or not.
1456 */
1457 public void userActivity();
1458
1459 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001460 * Called when we have finished booting and can now display the home
Jeff Brownc042ee22012-05-08 13:03:42 -07001461 * screen to the user. This will happen after systemReady(), and at
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001462 * this point the display is active.
1463 */
1464 public void enableScreenAfterBoot();
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001465
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001466 /**
1467 * Call from application to perform haptic feedback on its window.
1468 */
Alexey Kuzmine1f06b82018-06-20 17:48:43 +01001469 public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always,
1470 String reason);
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -07001471
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001472 /**
Daniel Sandler0601eb72011-04-13 01:01:32 -04001473 * Called when we have started keeping the screen on because a window
1474 * requesting this has become visible.
1475 */
Jeff Brownc38c9be2012-10-04 13:16:19 -07001476 public void keepScreenOnStartedLw();
Daniel Sandler0601eb72011-04-13 01:01:32 -04001477
1478 /**
1479 * Called when we have stopped keeping the screen on because the last window
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001480 * requesting this is no longer visible.
1481 */
Jeff Brownc38c9be2012-10-04 13:16:19 -07001482 public void keepScreenOnStoppedLw();
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001483
1484 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -07001485 * Called when a new system UI visibility is being reported, allowing
1486 * the policy to adjust what is actually reported.
Tor Norbyed9273d62013-05-30 15:59:53 -07001487 * @param visibility The raw visibility reported by the status bar.
Dianne Hackborndf89e652011-10-06 22:35:11 -07001488 * @return The new desired visibility.
1489 */
1490 public int adjustSystemUiVisibilityLw(int visibility);
1491
1492 /**
Winsonab216602016-08-09 14:05:20 -07001493 * Called by System UI to notify of changes to the visibility of Recents.
1494 */
1495 public void setRecentsVisibilityLw(boolean visible);
1496
1497 /**
1498 * Called by System UI to notify of changes to the visibility of PIP.
1499 */
Winson Chungac52f282017-03-30 14:44:52 -07001500 void setPipVisibilityLw(boolean visible);
Winsonab216602016-08-09 14:05:20 -07001501
1502 /**
Matthew Ng64543e62018-02-28 17:35:10 -08001503 * Called by System UI to enable or disable haptic feedback on the navigation bar buttons.
1504 */
1505 void setNavBarVirtualKeyHapticFeedbackEnabledLw(boolean enabled);
1506
1507 /**
Daniel Sandler0c4ccff2011-10-19 16:39:14 -04001508 * Specifies whether there is an on-screen navigation bar separate from the status bar.
1509 */
1510 public boolean hasNavigationBar();
1511
1512 /**
Jim Miller93c518e2012-01-17 15:55:31 -08001513 * Lock the device now.
1514 */
Adam Cohenf7522022012-10-03 20:03:18 -07001515 public void lockNow(Bundle options);
Jim Miller93c518e2012-01-17 15:55:31 -08001516
1517 /**
Yohei Yukawad6475a62017-04-17 10:35:27 -07001518 * An internal callback (from InputMethodManagerService) to notify a state change regarding
1519 * whether the back key should dismiss the software keyboard (IME) or not.
1520 *
1521 * @param newValue {@code true} if the software keyboard is shown and the back key is expected
1522 * to dismiss the software keyboard.
1523 * @hide
1524 */
1525 default void setDismissImeOnBackKeyPressed(boolean newValue) {
1526 // Default implementation does nothing.
1527 }
1528
1529 /**
Craig Mautner84984fa2014-06-19 11:19:20 -07001530 * Show the recents task list app.
1531 * @hide
1532 */
Winson Chungdff7a732017-12-11 12:17:06 -08001533 public void showRecentApps();
Craig Mautner84984fa2014-06-19 11:19:20 -07001534
1535 /**
Alan Viverettee34560b22014-07-10 14:50:06 -07001536 * Show the global actions dialog.
1537 * @hide
1538 */
1539 public void showGlobalActions();
1540
1541 /**
Craig Mautnerf1b67412012-09-19 13:18:29 -07001542 * Called when the current user changes. Guaranteed to be called before the broadcast
1543 * of the new user id is made to all listeners.
1544 *
1545 * @param newUserId The id of the incoming user.
1546 */
1547 public void setCurrentUserLw(int newUserId);
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07001548
1549 /**
Evan Rosky18396452016-07-27 15:19:37 -07001550 * For a given user-switch operation, this will be called once with switching=true before the
1551 * user-switch and once with switching=false afterwards (or if the user-switch was cancelled).
1552 * This gives the policy a chance to alter its behavior for the duration of a user-switch.
1553 *
1554 * @param switching true if a user-switch is in progress
1555 */
1556 void setSwitchingUser(boolean switching);
1557
1558 /**
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001559 * Print the WindowManagerPolicy's state into the given stream.
1560 *
1561 * @param prefix Text to print at the front of each line.
Dianne Hackbornf99f9c52011-01-12 15:49:25 -08001562 * @param writer The PrintWriter to which you should dump your state. This will be
1563 * closed for you after you return.
1564 * @param args additional arguments to the dump request.
1565 */
Jeff Brownd7a04de2012-06-17 14:17:52 -07001566 public void dump(String prefix, PrintWriter writer, String[] args);
Jim Miller4eeb4f62012-11-08 00:04:29 -08001567
1568 /**
Steven Timotiusaf03df62017-07-18 16:56:43 -07001569 * Write the WindowManagerPolicy's state into the protocol buffer.
Yi Jin6c6e9ca2018-03-20 16:53:35 -07001570 * The message is described in {@link com.android.server.wm.WindowManagerPolicyProto}
Steven Timotiusaf03df62017-07-18 16:56:43 -07001571 *
1572 * @param proto The protocol buffer output stream to write to.
1573 */
1574 void writeToProto(ProtoOutputStream proto, long fieldId);
1575
1576 /**
Svetoslav Ganov545252f2012-12-10 18:29:24 -08001577 * Returns whether a given window type is considered a top level one.
1578 * A top level window does not have a container, i.e. attached window,
1579 * or if it has a container it is laid out as a top-level window, not
1580 * as a child of its container.
1581 *
1582 * @param windowType The window type.
1583 * @return True if the window is a top level one.
1584 */
1585 public boolean isTopLevelWindow(int windowType);
Jorim Jaggi0d674622014-05-21 01:34:15 +02001586
1587 /**
1588 * Notifies the keyguard to start fading out.
Jorim Jaggie29b2db2014-05-30 23:17:03 +02001589 *
1590 * @param startTime the start time of the animation in uptime milliseconds
1591 * @param fadeoutDuration the duration of the exit animation, in milliseconds
Jorim Jaggi0d674622014-05-21 01:34:15 +02001592 */
Jorim Jaggie29b2db2014-05-30 23:17:03 +02001593 public void startKeyguardExitAnimation(long startTime, long fadeoutDuration);
Jorim Jaggi737af722015-12-31 10:42:27 +01001594
1595 /**
1596 * Calculates the stable insets without running a layout.
1597 *
1598 * @param displayRotation the current display rotation
Jorim Jaggi737af722015-12-31 10:42:27 +01001599 * @param displayWidth the current display width
1600 * @param displayHeight the current display height
Adrian Roos11c25582018-02-19 18:06:36 +01001601 * @param displayCutout the current display cutout
Winson3e874742016-01-07 10:08:17 -08001602 * @param outInsets the insets to return
Jorim Jaggi737af722015-12-31 10:42:27 +01001603 */
1604 public void getStableInsetsLw(int displayRotation, int displayWidth, int displayHeight,
Adrian Roos11c25582018-02-19 18:06:36 +01001605 DisplayCutout displayCutout, Rect outInsets);
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001606
Jorim Jaggi0ffd49c2016-02-12 15:04:21 -08001607
1608 /**
1609 * @return true if the navigation bar is forced to stay visible
1610 */
1611 public boolean isNavBarForcedShownLw(WindowState win);
1612
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001613 /**
Andrii Kulian3a1619d2017-07-07 14:38:09 -07001614 * @return The side of the screen where navigation bar is positioned.
1615 * @see #NAV_BAR_LEFT
1616 * @see #NAV_BAR_RIGHT
1617 * @see #NAV_BAR_BOTTOM
1618 */
Yohei Yukawad0a66b22018-01-10 13:19:54 -08001619 @NavigationBarPosition
Andrii Kulian3a1619d2017-07-07 14:38:09 -07001620 int getNavBarPosition();
1621
1622 /**
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001623 * Calculates the insets for the areas that could never be removed in Honeycomb, i.e. system
1624 * bar or button bar. See {@link #getNonDecorDisplayWidth}.
1625 *
1626 * @param displayRotation the current display rotation
1627 * @param displayWidth the current display width
1628 * @param displayHeight the current display height
Adrian Roos11c25582018-02-19 18:06:36 +01001629 * @param displayCutout the current display cutout
Jorim Jaggi82c9dc92016-02-05 15:10:33 -08001630 * @param outInsets the insets to return
1631 */
1632 public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight,
Adrian Roos11c25582018-02-19 18:06:36 +01001633 DisplayCutout displayCutout, Rect outInsets);
Jorim Jaggi5060bd82016-02-19 17:12:19 -08001634
1635 /**
Matthew Ng62c78462018-04-09 14:43:21 -07001636 * @param displayRotation the current display rotation
1637 * @param displayWidth the current display width
1638 * @param displayHeight the current display height
1639 * @param dockSide the dockside asking if allowed
1640 * @param originalDockSide the side that was original docked to in split screen
Jorim Jaggi5060bd82016-02-19 17:12:19 -08001641 * @return True if a specified {@param dockSide} is allowed on the current device, or false
1642 * otherwise. It is guaranteed that at least one dock side for a particular orientation
1643 * is allowed, so for example, if DOCKED_RIGHT is not allowed, DOCKED_LEFT is allowed.
Matthew Ng62c78462018-04-09 14:43:21 -07001644 * If navigation bar is movable then the docked side would bias towards the
1645 * {@param originalDockSide}.
Jorim Jaggi5060bd82016-02-19 17:12:19 -08001646 */
Matthew Ng62c78462018-04-09 14:43:21 -07001647 public boolean isDockSideAllowed(int dockSide, int originalDockSide, int displayWidth,
1648 int displayHeight, int displayRotation);
Jorim Jaggi11c62e12016-04-05 20:41:21 -07001649
1650 /**
1651 * Called when the configuration has changed, and it's safe to load new values from resources.
1652 */
Riddle Hsuad256a12018-07-18 16:11:30 +08001653 public void onConfigurationChanged(DisplayContentInfo displayContentInfo);
Robert Carr6da3cc02016-06-16 15:17:07 -07001654
Riddle Hsuad256a12018-07-18 16:11:30 +08001655 public boolean shouldRotateSeamlessly(DisplayRotation displayRotation,
1656 int oldRotation, int newRotation);
Keun-young Park4136d2d2017-05-08 14:51:59 -07001657
1658 /**
1659 * Called when System UI has been started.
1660 */
1661 void onSystemUiStarted();
1662
1663 /**
1664 * Checks whether the policy is ready for dismissing the boot animation and completing the boot.
1665 *
1666 * @return true if ready; false otherwise.
1667 */
1668 boolean canDismissBootAnimation();
Michael Wright19859762017-09-18 20:57:58 +01001669
1670 /**
1671 * Convert the user rotation mode to a human readable format.
1672 */
1673 static String userRotationModeToString(int mode) {
1674 switch(mode) {
1675 case USER_ROTATION_FREE:
1676 return "USER_ROTATION_FREE";
1677 case USER_ROTATION_LOCKED:
1678 return "USER_ROTATION_LOCKED";
1679 default:
1680 return Integer.toString(mode);
1681 }
1682 }
Yoshiaki Nakae1bdfc822017-09-15 15:24:34 +09001683
1684 /**
Jordan Liuc0228762018-07-13 11:39:42 -07001685 * Requests that the WindowManager sends
1686 * WindowManagerPolicyConstants#ACTION_USER_ACTIVITY_NOTIFICATION on the next user activity.
Yoshiaki Nakae1bdfc822017-09-15 15:24:34 +09001687 */
1688 public void requestUserActivityNotification();
Benjamin Franz3662b152018-01-16 17:23:44 +00001689
1690 /**
1691 * Called when the state of lock task mode changes. This should be used to disable immersive
1692 * mode confirmation.
1693 *
1694 * @param lockTaskState the new lock task mode state. One of
1695 * {@link ActivityManager#LOCK_TASK_MODE_NONE},
1696 * {@link ActivityManager#LOCK_TASK_MODE_LOCKED},
1697 * {@link ActivityManager#LOCK_TASK_MODE_PINNED}.
1698 */
1699 void onLockTaskStateChangedLw(int lockTaskState);
chaviw0e9fb132018-06-05 16:29:13 -07001700
1701 /**
1702 * Updates the flag about whether AOD is showing.
1703 *
1704 * @return whether the value was changed.
1705 */
1706 boolean setAodShowing(boolean aodShowing);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001707}