The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 2 | * Copyright (C) 2017 The Android Open Source Project |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 17 | package com.android.server.policy; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 18 | |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 19 | import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW; |
| 20 | import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; |
| 21 | import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY; |
| 22 | import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL; |
| 23 | import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; |
| 24 | import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA; |
| 25 | import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY; |
| 26 | import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; |
| 27 | import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_PANEL; |
| 28 | import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL; |
| 29 | import static android.view.WindowManager.LayoutParams.TYPE_BOOT_PROGRESS; |
| 30 | import static android.view.WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY; |
| 31 | import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER; |
| 32 | import static android.view.WindowManager.LayoutParams.TYPE_DRAG; |
| 33 | import static android.view.WindowManager.LayoutParams.TYPE_DREAM; |
| 34 | import static android.view.WindowManager.LayoutParams.TYPE_INPUT_CONSUMER; |
| 35 | import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; |
| 36 | import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; |
| 37 | import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG; |
| 38 | import static android.view.WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY; |
| 39 | import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR; |
| 40 | import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; |
| 41 | import static android.view.WindowManager.LayoutParams.TYPE_PHONE; |
| 42 | import static android.view.WindowManager.LayoutParams.TYPE_POINTER; |
| 43 | import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION; |
| 44 | import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE; |
| 45 | import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION; |
| 46 | import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG; |
| 47 | import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT; |
| 48 | import static android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR; |
| 49 | import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY; |
| 50 | import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; |
| 51 | import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL; |
| 52 | import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL; |
| 53 | import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; |
| 54 | import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG; |
| 55 | import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR; |
| 56 | import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY; |
| 57 | import static android.view.WindowManager.LayoutParams.TYPE_TOAST; |
| 58 | import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION; |
| 59 | import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION_STARTING; |
| 60 | import static android.view.WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY; |
| 61 | import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; |
| 62 | import static android.view.WindowManager.LayoutParams.isSystemAlertWindowType; |
| 63 | |
Yohei Yukawa | d0a66b2 | 2018-01-10 13:19:54 -0800 | [diff] [blame] | 64 | import static java.lang.annotation.RetentionPolicy.SOURCE; |
| 65 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 66 | import android.annotation.IntDef; |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 67 | import android.annotation.Nullable; |
Benjamin Franz | 3662b15 | 2018-01-16 17:23:44 +0000 | [diff] [blame] | 68 | import android.app.ActivityManager; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 69 | import android.content.Context; |
Dianne Hackborn | 2f0b175 | 2011-05-31 17:59:49 -0700 | [diff] [blame] | 70 | import android.content.res.CompatibilityInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 71 | import android.content.res.Configuration; |
| 72 | import android.graphics.Rect; |
Adam Cohen | f752202 | 2012-10-03 20:03:18 -0700 | [diff] [blame] | 73 | import android.os.Bundle; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 74 | import android.os.IBinder; |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 75 | import android.os.Looper; |
Muyuan Li | 94ce94e | 2016-02-24 16:20:54 -0800 | [diff] [blame] | 76 | import android.os.RemoteException; |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 77 | import android.util.Slog; |
Steven Timotius | af03df6 | 2017-07-18 16:56:43 -0700 | [diff] [blame] | 78 | import android.util.proto.ProtoOutputStream; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 79 | import android.view.Display; |
Adrian Roos | 5c6b622 | 2017-11-07 17:36:10 +0100 | [diff] [blame] | 80 | import android.view.DisplayCutout; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 81 | import android.view.IApplicationToken; |
| 82 | import android.view.IWindowManager; |
| 83 | import android.view.InputEventReceiver; |
| 84 | import android.view.KeyEvent; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 85 | import android.view.WindowManager; |
| 86 | import android.view.WindowManagerGlobal; |
| 87 | import android.view.WindowManagerPolicyConstants; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 88 | import android.view.animation.Animation; |
Aurimas Liutikas | 67e2ae8 | 2016-10-11 18:17:42 -0700 | [diff] [blame] | 89 | |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 90 | import com.android.internal.policy.IKeyguardDismissCallback; |
Muyuan Li | 94ce94e | 2016-02-24 16:20:54 -0800 | [diff] [blame] | 91 | import com.android.internal.policy.IShortcutService; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 92 | import com.android.server.wm.DisplayFrames; |
Riddle Hsu | ad256a1 | 2018-07-18 16:11:30 +0800 | [diff] [blame] | 93 | import com.android.server.wm.DisplayRotation; |
chaviw | 553b021 | 2018-07-12 13:37:01 -0700 | [diff] [blame] | 94 | import com.android.server.wm.WindowFrames; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 95 | |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 96 | import java.io.PrintWriter; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 97 | import java.lang.annotation.Retention; |
| 98 | import java.lang.annotation.RetentionPolicy; |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 99 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 100 | /** |
| 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 105 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 106 | * <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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 114 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 115 | * <p>The current suffixes are: |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 116 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 117 | * <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 Project | c39a6e0 | 2009-03-11 12:11:56 -0700 | [diff] [blame] | 131 | * okay to make calls into the activity manager or most other services. Note that |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 132 | * {@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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 138 | */ |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 139 | public interface WindowManagerPolicy extends WindowManagerPolicyConstants { |
Yohei Yukawa | d0a66b2 | 2018-01-10 13:19:54 -0800 | [diff] [blame] | 140 | @Retention(SOURCE) |
| 141 | @IntDef({NAV_BAR_LEFT, NAV_BAR_RIGHT, NAV_BAR_BOTTOM}) |
| 142 | @interface NavigationBarPosition {} |
| 143 | |
Bryce Lee | 01b0c5f | 2015-02-05 18:24:04 -0800 | [diff] [blame] | 144 | /** |
Jeff Brown | d5bb82d | 2011-10-12 13:57:59 -0700 | [diff] [blame] | 145 | * Pass this event to the user / app. To be returned from |
| 146 | * {@link #interceptKeyBeforeQueueing}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 147 | */ |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 148 | 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 Nair | 83537a7 | 2018-07-19 21:27:48 -0700 | [diff] [blame] | 157 | /** Layer for the screen off animation */ |
| 158 | int COLOR_FADE_LAYER = 0x40000001; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 159 | |
| 160 | /** |
Muyuan Li | 94ce94e | 2016-02-24 16:20:54 -0800 | [diff] [blame] | 161 | * 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 Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 169 | * Called when the Keyguard occluded state changed. |
| 170 | * @param occluded Whether Keyguard is currently occluded or not. |
Adrian Roos | d88eb26 | 2016-08-04 14:50:48 -0700 | [diff] [blame] | 171 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 172 | void onKeyguardOccludedChangedLw(boolean occluded); |
Adrian Roos | d88eb26 | 2016-08-04 14:50:48 -0700 | [diff] [blame] | 173 | |
| 174 | /** |
Adrian Roos | 2f1a90b | 2018-01-09 17:28:49 +0100 | [diff] [blame] | 175 | * Called when the resource overlays change. |
| 176 | */ |
Riddle Hsu | ad256a1 | 2018-07-18 16:11:30 +0800 | [diff] [blame] | 177 | default void onOverlayChangedLw(DisplayContentInfo displayContentInfo) {} |
Adrian Roos | 2f1a90b | 2018-01-09 17:28:49 +0100 | [diff] [blame] | 178 | |
| 179 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 180 | * 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 Hackborn | f265ea9 | 2013-01-31 15:00:51 -0800 | [diff] [blame] | 186 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 196 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 199 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 200 | */ |
chaviw | 1454b39 | 2018-08-06 09:54:04 -0700 | [diff] [blame] | 201 | public void computeFrameLw(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 202 | |
| 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 206 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 207 | * @return Rect The rectangle holding the window frame. |
| 208 | */ |
| 209 | public Rect getFrameLw(); |
| 210 | |
| 211 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 212 | * 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 Hackborn | 5c58de3 | 2012-04-28 19:52:37 -0700 | [diff] [blame] | 215 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 216 | * @return Rect The rectangle holding the display frame. |
| 217 | */ |
| 218 | public Rect getDisplayFrameLw(); |
| 219 | |
| 220 | /** |
Dianne Hackborn | c4aad01 | 2013-02-22 15:05:25 -0800 | [diff] [blame] | 221 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 230 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 236 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 237 | * @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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 248 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 249 | * @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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 259 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 260 | /** |
| 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 264 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 265 | * @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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 274 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 275 | * @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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 282 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 283 | * @return WindowManager.LayoutParams The window's internal LayoutParams |
| 284 | * instance. |
| 285 | */ |
| 286 | public WindowManager.LayoutParams getAttrs(); |
| 287 | |
| 288 | /** |
Dianne Hackborn | 73ab6a4 | 2011-12-13 11:16:23 -0800 | [diff] [blame] | 289 | * 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 Hackborn | 9a230e0 | 2011-10-06 11:51:27 -0700 | [diff] [blame] | 297 | * Retrieve the current system UI visibility flags associated with |
| 298 | * this window. |
| 299 | */ |
| 300 | public int getSystemUiVisibility(); |
| 301 | |
| 302 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 303 | * Get the layer at which this window's surface will be Z-ordered. |
| 304 | */ |
| 305 | public int getSurfaceLayer(); |
Selim Cinek | d662361 | 2015-05-22 18:56:22 -0700 | [diff] [blame] | 306 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 307 | /** |
Selim Cinek | d662361 | 2015-05-22 18:56:22 -0700 | [diff] [blame] | 308 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 318 | * @return An IApplicationToken identifying the owning activity. |
| 319 | */ |
| 320 | public IApplicationToken getAppToken(); |
| 321 | |
| 322 | /** |
Dianne Hackborn | e30e02f | 2014-05-27 18:24:45 -0700 | [diff] [blame] | 323 | * Return true if this window is participating in voice interaction. |
| 324 | */ |
| 325 | public boolean isVoiceInteraction(); |
| 326 | |
| 327 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 328 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 334 | * else false. |
| 335 | */ |
| 336 | public boolean hasAppShownWindows(); |
| 337 | |
| 338 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 339 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 344 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 345 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 346 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 348 | * animation before no longer being visible. Must be called with the |
| 349 | * window manager lock held. |
| 350 | */ |
| 351 | boolean isDisplayedLw(); |
| 352 | |
| 353 | /** |
Dianne Hackborn | 5c58de3 | 2012-04-28 19:52:37 -0700 | [diff] [blame] | 354 | * Return true if this window (or a window it is attached to, but not |
| 355 | * considering its app token) is currently animating. |
| 356 | */ |
Filip Gruszczynski | 14b4e57 | 2015-11-03 15:53:55 -0800 | [diff] [blame] | 357 | boolean isAnimatingLw(); |
Dianne Hackborn | 5c58de3 | 2012-04-28 19:52:37 -0700 | [diff] [blame] | 358 | |
| 359 | /** |
Jorim Jaggi | 23cc9aa | 2017-05-23 16:05:35 +0200 | [diff] [blame] | 360 | * @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 Hackborn | 01b02a7 | 2012-01-12 14:05:03 -0800 | [diff] [blame] | 367 | * Is this window considered to be gone for purposes of layout? |
| 368 | */ |
| 369 | boolean isGoneForLayoutLw(); |
| 370 | |
| 371 | /** |
Adrian Roos | 76d2fe4 | 2015-07-09 14:54:08 -0700 | [diff] [blame] | 372 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 380 | * Returns true if this window has been shown on screen at some time in |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 381 | * the past. Must be called with the window manager lock held. |
Jorim Jaggi | a32da38 | 2018-03-28 18:01:22 +0200 | [diff] [blame] | 382 | * |
| 383 | * @deprecated Use {@link #isDrawnLw} or any of the other drawn/visibility methods. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 384 | */ |
Jorim Jaggi | a32da38 | 2018-03-28 18:01:22 +0200 | [diff] [blame] | 385 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 386 | 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 395 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 396 | /** |
| 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 Hackborn | f87d196 | 2012-04-04 12:48:24 -0700 | [diff] [blame] | 404 | |
| 405 | /** |
| 406 | * Check whether the process hosting this window is currently alive. |
| 407 | */ |
| 408 | public boolean isAlive(); |
Craig Mautner | 69b0818 | 2012-09-05 13:07:13 -0700 | [diff] [blame] | 409 | |
| 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 Roos | cd3884d | 2015-02-18 17:25:23 +0100 | [diff] [blame] | 415 | |
| 416 | /** |
| 417 | * Check whether the window is currently dimming. |
| 418 | */ |
| 419 | public boolean isDimming(); |
Jorim Jaggi | 8690558 | 2016-02-09 21:36:09 -0800 | [diff] [blame] | 420 | |
Adrian Roos | 865c70f | 2018-01-10 17:32:27 +0100 | [diff] [blame] | 421 | /** |
| 422 | * Returns true if the window is letterboxed for the display cutout. |
| 423 | */ |
| 424 | default boolean isLetterboxedForDisplayCutoutLw() { |
| 425 | return false; |
| 426 | } |
| 427 | |
Adrian Roos | 23df3a3 | 2018-03-15 15:41:13 +0100 | [diff] [blame] | 428 | /** |
| 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 Ogunwale | 44f036f | 2017-09-29 05:09:09 -0700 | [diff] [blame] | 436 | /** @return the current windowing mode of this window. */ |
| 437 | int getWindowingMode(); |
Wale Ogunwale | 9185fb0 | 2016-03-11 18:06:14 -0800 | [diff] [blame] | 438 | |
| 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 Kulian | 933076d | 2016-03-29 17:04:42 -0700 | [diff] [blame] | 443 | public boolean isInMultiWindowMode(); |
Robert Carr | fd10cd1 | 2016-06-29 16:41:50 -0700 | [diff] [blame] | 444 | |
| 445 | public int getRotationAnimationHint(); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 446 | |
| 447 | public boolean isInputMethodWindow(); |
| 448 | |
Robert Carr | 825581a | 2018-03-30 14:00:53 -0700 | [diff] [blame] | 449 | public boolean isInputMethodTarget(); |
| 450 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 451 | public int getDisplayId(); |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 452 | |
| 453 | /** |
| 454 | * Returns true if the window owner can add internal system windows. |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 455 | * That is, they have {@link Manifest.permission#INTERNAL_SYSTEM_WINDOW}. |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 456 | */ |
| 457 | default boolean canAddInternalSystemWindow() { |
| 458 | return false; |
| 459 | } |
Jorim Jaggi | f12ec0f | 2017-08-23 16:14:10 +0200 | [diff] [blame] | 460 | |
| 461 | /** |
| 462 | * Returns true if the window owner has the permission to acquire a sleep token when it's |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 463 | * visible. That is, they have the permission {@link Manifest.permission#DEVICE_POWER}. |
Jorim Jaggi | f12ec0f | 2017-08-23 16:14:10 +0200 | [diff] [blame] | 464 | */ |
| 465 | boolean canAcquireSleepToken(); |
Vishnu Nair | 9a3e406 | 2018-01-11 08:42:54 -0800 | [diff] [blame] | 466 | |
Tiger Huang | 513d5e1 | 2018-07-16 21:49:50 +0800 | [diff] [blame] | 467 | /** @return true if this window desires key events. */ |
| 468 | boolean canReceiveKeys(); |
| 469 | |
Vishnu Nair | 9a3e406 | 2018-01-11 08:42:54 -0800 | [diff] [blame] | 470 | /** |
Yi Jin | 6c6e9ca | 2018-03-20 16:53:35 -0700 | [diff] [blame] | 471 | * Writes {@link com.android.server.wm.IdentifierProto} to stream. |
Vishnu Nair | 9a3e406 | 2018-01-11 08:42:54 -0800 | [diff] [blame] | 472 | */ |
| 473 | void writeIdentifierToProto(ProtoOutputStream proto, long fieldId); |
chaviw | 1454b39 | 2018-08-06 09:54:04 -0700 | [diff] [blame] | 474 | |
| 475 | /** |
| 476 | * @return The {@link WindowFrames} associated with this {@link WindowState} |
| 477 | */ |
| 478 | WindowFrames getWindowFrames(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 479 | } |
| 480 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 481 | /** |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 482 | * 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 Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 484 | */ |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 485 | public interface InputConsumer { |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 486 | /** |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 487 | * Remove the input consumer from the window manager. |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 488 | */ |
| 489 | void dismiss(); |
| 490 | } |
| 491 | |
| 492 | /** |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 493 | * 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 Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 495 | * held by WM and released with {@link #remove} when no longer needed. |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 496 | */ |
| 497 | interface StartingSurface { |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 498 | |
| 499 | /** |
| 500 | * Removes the starting window surface. Do not hold the window manager lock when calling |
| 501 | * this method! |
| 502 | */ |
| 503 | void remove(); |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 504 | } |
| 505 | |
| 506 | /** |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 507 | * Interface for calling back in to the window manager that is private |
| 508 | * between it and the policy. |
| 509 | */ |
| 510 | public interface WindowManagerFuncs { |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 511 | 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 Wright | 3818c92 | 2014-09-02 13:59:07 -0700 | [diff] [blame] | 515 | 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 Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 519 | /** |
| 520 | * Ask the window manager to re-evaluate the system UI flags. |
| 521 | */ |
| 522 | public void reevaluateStatusBarVisibility(); |
| 523 | |
| 524 | /** |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 525 | * Add a input consumer which will consume all input events going to any window below it. |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 526 | */ |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 527 | public InputConsumer createInputConsumer(Looper looper, String name, |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 528 | InputEventReceiver.Factory inputEventReceiverFactory, int displayId); |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 529 | |
| 530 | /** |
| 531 | * Returns a code that describes the current state of the lid switch. |
| 532 | */ |
| 533 | public int getLidState(); |
| 534 | |
| 535 | /** |
Edward Savage-Jones | 7def60d | 2015-11-13 13:27:03 +0100 | [diff] [blame] | 536 | * Lock the device now. |
| 537 | */ |
| 538 | public void lockDeviceNow(); |
| 539 | |
| 540 | /** |
Michael Wright | 3818c92 | 2014-09-02 13:59:07 -0700 | [diff] [blame] | 541 | * Returns a code that descripbes whether the camera lens is covered or not. |
| 542 | */ |
| 543 | public int getCameraLensCoverState(); |
| 544 | |
| 545 | /** |
Yohei Yukawa | 2d9accb | 2018-03-07 19:15:15 -0800 | [diff] [blame] | 546 | * 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 Brown | 9a538ee | 2012-08-20 14:56:57 -0700 | [diff] [blame] | 551 | public void shutdown(boolean confirm); |
Alison Cichowlas | f8eca40 | 2016-08-05 14:50:27 -0400 | [diff] [blame] | 552 | public void reboot(boolean confirm); |
Jeff Brown | 9a538ee | 2012-08-20 14:56:57 -0700 | [diff] [blame] | 553 | public void rebootSafeMode(boolean confirm); |
John Spurlock | 04db176 | 2013-05-13 12:46:41 -0400 | [diff] [blame] | 554 | |
| 555 | /** |
| 556 | * Return the window manager lock needed to correctly call "Lw" methods. |
| 557 | */ |
| 558 | public Object getWindowManagerLock(); |
Craig Mautner | 037aa8d | 2013-06-07 10:35:44 -0700 | [diff] [blame] | 559 | |
| 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 Jaggi | 81ba11e | 2016-02-03 22:04:22 -0800 | [diff] [blame] | 565 | |
| 566 | /** |
| 567 | * @return The content insets of the docked divider window. |
| 568 | */ |
| 569 | int getDockedDividerInsetsLw(); |
Jorim Jaggi | 8690558 | 2016-02-09 21:36:09 -0800 | [diff] [blame] | 570 | |
| 571 | /** |
Wale Ogunwale | 6827856 | 2017-09-23 17:13:55 -0700 | [diff] [blame] | 572 | * Retrieves the {@param outBounds} from the stack matching the {@param windowingMode} and |
| 573 | * {@param activityType}. |
Jorim Jaggi | 8690558 | 2016-02-09 21:36:09 -0800 | [diff] [blame] | 574 | */ |
Wale Ogunwale | 6827856 | 2017-09-23 17:13:55 -0700 | [diff] [blame] | 575 | void getStackBounds(int windowingMode, int activityType, Rect outBounds); |
Jorim Jaggi | 77e1043 | 2016-10-26 17:43:56 -0700 | [diff] [blame] | 576 | |
| 577 | /** |
| 578 | * Notifies window manager that {@link #isShowingDreamLw} has changed. |
| 579 | */ |
| 580 | void notifyShowingDreamChanged(); |
Jorim Jaggi | e69c931 | 2016-10-31 18:24:38 -0700 | [diff] [blame] | 581 | |
| 582 | /** |
Jorim Jaggi | 40db029 | 2016-06-27 17:58:03 -0700 | [diff] [blame] | 583 | * @return The currently active input method window. |
| 584 | */ |
| 585 | WindowState getInputMethodWindowLw(); |
| 586 | |
| 587 | /** |
Jorim Jaggi | e69c931 | 2016-10-31 18:24:38 -0700 | [diff] [blame] | 588 | * Notifies window manager that {@link #isKeyguardTrustedLw} has changed. |
| 589 | */ |
| 590 | void notifyKeyguardTrustedChanged(); |
Jorim Jaggi | 51304d7 | 2017-05-17 17:25:32 +0200 | [diff] [blame] | 591 | |
| 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 Wright | 1985976 | 2017-09-18 20:57:58 +0100 | [diff] [blame] | 598 | |
| 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 Roos | 842e788 | 2018-03-26 17:34:06 +0200 | [diff] [blame] | 630 | |
| 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 Roos | 4163d62 | 2018-05-22 16:56:35 +0200 | [diff] [blame] | 636 | |
| 637 | /** |
| 638 | * The keyguard showing state has changed |
| 639 | */ |
| 640 | void onKeyguardShowingAndNotOccludedChanged(); |
Riddle Hsu | ad256a1 | 2018-07-18 16:11:30 +0800 | [diff] [blame] | 641 | |
| 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 Mautner | 037aa8d | 2013-06-07 10:35:44 -0700 | [diff] [blame] | 662 | } |
| 663 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 664 | /** Window has been added to the screen. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 665 | public static final int TRANSIT_ENTER = 1; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 666 | /** Window has been removed from the screen. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 667 | public static final int TRANSIT_EXIT = 2; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 668 | /** Window has been made visible. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 669 | 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 673 | /** The "application starting" preview window is no longer needed, and will |
| 674 | * animate away to show the real window. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 675 | public static final int TRANSIT_PREVIEW_DONE = 5; |
| 676 | |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 677 | // NOTE: screen off reasons are in order of significance, with more |
| 678 | // important ones lower than less important ones. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 679 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 680 | /** @hide */ |
| 681 | @IntDef({USER_ROTATION_FREE, USER_ROTATION_LOCKED}) |
| 682 | @Retention(RetentionPolicy.SOURCE) |
| 683 | public @interface UserRotationMode {} |
| 684 | |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 685 | /** 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 691 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 692 | /** |
Riddle Hsu | 5ce4bb3 | 2018-07-18 16:11:30 +0800 | [diff] [blame] | 693 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 698 | * Perform initialization of the policy. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 699 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 700 | * @param context The system context we are running in. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 701 | */ |
| 702 | public void init(Context context, IWindowManager windowManager, |
Jeff Brown | 9630704 | 2012-07-27 15:51:34 -0700 | [diff] [blame] | 703 | WindowManagerFuncs windowManagerFuncs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 704 | |
| 705 | /** |
| 706 | * Check permissions when adding a window. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 707 | * |
Dianne Hackborn | c229302 | 2013-02-06 23:14:49 -0800 | [diff] [blame] | 708 | * @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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 711 | * |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 712 | * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 713 | * else an error code, usually |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 714 | * {@link WindowManagerGlobal#ADD_PERMISSION_DENIED}, to abort the add. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 715 | */ |
Dianne Hackborn | c229302 | 2013-02-06 23:14:49 -0800 | [diff] [blame] | 716 | public int checkAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 717 | |
| 718 | /** |
Craig Mautner | 88400d3 | 2012-09-30 12:35:45 -0700 | [diff] [blame] | 719 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 729 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 732 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 733 | * @param attrs The window layout parameters to be modified. These values |
| 734 | * are modified in-place. |
| 735 | */ |
Wale Ogunwale | c0b0f93 | 2017-11-01 12:51:43 -0700 | [diff] [blame] | 736 | public void adjustWindowParamsLw(WindowState win, WindowManager.LayoutParams attrs, |
| 737 | boolean hasStatusBarServicePermission); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 738 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 739 | /** |
| 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 744 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 745 | * <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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 747 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 748 | * @param config The Configuration being computed, for you to change as |
| 749 | * desired. |
Jeff Brown | daa3753 | 2012-05-01 15:54:03 -0700 | [diff] [blame] | 750 | * @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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 754 | */ |
Jeff Brown | daa3753 | 2012-05-01 15:54:03 -0700 | [diff] [blame] | 755 | public void adjustConfigurationLw(Configuration config, int keyboardPresence, |
| 756 | int navigationPresence); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 757 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 758 | /** |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 759 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 771 | * kinds of windows are ordered on-screen. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 772 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 773 | * @param type The type of window being assigned. |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 774 | * @return int An arbitrary integer used to order windows, with lower numbers below higher ones. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 775 | */ |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 776 | 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 783 | |
| 784 | /** |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 785 | * 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 Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 791 | * {@link Manifest.permission#INTERNAL_SYSTEM_WINDOW}. If true, alert window |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 792 | * 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 Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 832 | case TYPE_SYSTEM_ALERT: |
| 833 | // like the ANR / app crashed dialogs |
| 834 | return canAddInternalSystemWindow ? 11 : 10; |
| 835 | case TYPE_APPLICATION_OVERLAY: |
Wale Ogunwale | d993a57 | 2017-02-05 13:52:09 -0800 | [diff] [blame] | 836 | return 12; |
| 837 | case TYPE_DREAM: |
| 838 | // used for Dreams (screensavers with TYPE_DREAM windows) |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 839 | 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 Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 846 | case TYPE_STATUS_BAR: |
Robert Carr | 8360a78 | 2017-11-22 12:47:58 -0800 | [diff] [blame] | 847 | return 17; |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 848 | case TYPE_STATUS_BAR_PANEL: |
Robert Carr | 8360a78 | 2017-11-22 12:47:58 -0800 | [diff] [blame] | 849 | return 18; |
| 850 | case TYPE_STATUS_BAR_SUB_PANEL: |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 851 | 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 Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 901 | /** |
| 902 | * Return how to Z-order sub-windows in relation to the window they are attached to. |
| 903 | * Return positive to have them ordered in front, negative for behind. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 904 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 905 | * @param type The sub-window type code. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 906 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 907 | * @return int Layer in relation to the attached window, where positive is |
| 908 | * above and negative is below. |
| 909 | */ |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 910 | 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 927 | |
| 928 | /** |
Dianne Hackborn | 6136b7e | 2009-09-18 01:53:49 -0700 | [diff] [blame] | 929 | * Get the highest layer (actually one more than) that the wallpaper is |
| 930 | * allowed to be in. |
| 931 | */ |
| 932 | public int getMaxWallpaperLayer(); |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 933 | |
| 934 | /** |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 935 | * Return the display width available after excluding any screen |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 936 | * decorations that could never be removed in Honeycomb. That is, system bar or |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 937 | * button bar. |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 938 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 939 | public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 940 | int uiMode, int displayId, DisplayCutout displayCutout); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 941 | |
| 942 | /** |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 943 | * Return the display height available after excluding any screen |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 944 | * decorations that could never be removed in Honeycomb. That is, system bar or |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 945 | * button bar. |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 946 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 947 | public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 948 | int uiMode, int displayId, DisplayCutout displayCutout); |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 949 | |
| 950 | /** |
| 951 | * Return the available screen width that we should report for the |
| 952 | * configuration. This must be no larger than |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 953 | * {@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 Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 955 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 956 | public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 957 | int uiMode, int displayId, DisplayCutout displayCutout); |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 958 | |
| 959 | /** |
| 960 | * Return the available screen height that we should report for the |
| 961 | * configuration. This must be no larger than |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 962 | * {@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 Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 964 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 965 | public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 966 | int uiMode, int displayId, DisplayCutout displayCutout); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 967 | |
| 968 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 969 | * Return whether the given window can become the Keyguard window. Typically returns true for |
| 970 | * the StatusBar. |
Jorim Jaggi | 0d67462 | 2014-05-21 01:34:15 +0200 | [diff] [blame] | 971 | */ |
| 972 | public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs); |
| 973 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 974 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 975 | * @return whether {@param win} can be hidden by Keyguard |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 976 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 977 | public boolean canBeHiddenByKeyguardLw(WindowState win); |
Craig Mautner | 7d7808f | 2014-09-11 18:02:38 -0700 | [diff] [blame] | 978 | |
| 979 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 980 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 986 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 987 | * @param appToken Token of the application being started. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 988 | * @param packageName The name of the application package being started. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 989 | * @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 Hackborn | 7eec10e | 2010-11-12 18:03:47 -0800 | [diff] [blame] | 994 | * @param windowFlags Window layout flags. |
Wale Ogunwale | dfc1862 | 2016-04-16 15:08:48 -0700 | [diff] [blame] | 995 | * @param overrideConfig override configuration to consider when generating |
| 996 | * context to for resources. |
Andrii Kulian | fb1bf69 | 2017-01-17 11:17:34 -0800 | [diff] [blame] | 997 | * @param displayId Id of the display to show the splash screen at. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 998 | * |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 999 | * @return The starting surface. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1000 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1001 | */ |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 1002 | public StartingSurface addSplashScreen(IBinder appToken, String packageName, int theme, |
| 1003 | CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, |
Andrii Kulian | fb1bf69 | 2017-01-17 11:17:34 -0800 | [diff] [blame] | 1004 | int logo, int windowFlags, Configuration overrideConfig, int displayId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1005 | |
| 1006 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1007 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1010 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1011 | * @param win The window being added. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1012 | * @param attrs The window's LayoutParams. |
| 1013 | * |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 1014 | * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed, else an |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1015 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1023 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1024 | * @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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1032 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1033 | * @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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1037 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1038 | * @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 Mautner | 3c17437 | 2013-02-21 17:54:37 -0800 | [diff] [blame] | 1043 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1046 | * |
| 1047 | * @param anim The exiting animation resource id is stored in anim[0], the |
Craig Mautner | 3c17437 | 2013-02-21 17:54:37 -0800 | [diff] [blame] | 1048 | * 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 Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1068 | * Create and return an animation to re-display a window that was force hidden by Keyguard. |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 1069 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1070 | public Animation createHiddenByKeyguardExit(boolean onWallpaper, |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 1071 | boolean goingToNotificationShade); |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 1072 | |
| 1073 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1074 | * Create and return an animation to let the wallpaper disappear after being shown behind |
| 1075 | * Keyguard. |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 1076 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1077 | public Animation createKeyguardWallpaperExit(boolean goingToNotificationShade); |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 1078 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 1079 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1080 | * Called from the input reader thread before a key is enqueued. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1081 | * |
| 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 Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 1086 | * @param event The key event. |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1087 | * @param policyFlags The policy flags associated with the key. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1088 | * |
Jeff Brown | 2687550 | 2014-01-30 21:47:47 -0800 | [diff] [blame] | 1089 | * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1090 | */ |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 1091 | public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags); |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 1092 | |
| 1093 | /** |
Michael Wright | 70af00a | 2014-09-03 19:30:20 -0700 | [diff] [blame] | 1094 | * Called from the input reader thread before a motion is enqueued when the device is in a |
| 1095 | * non-interactive state. |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 1096 | * |
| 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 Brown | 2687550 | 2014-01-30 21:47:47 -0800 | [diff] [blame] | 1103 | * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}. |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 1104 | */ |
Michael Wright | 70af00a | 2014-09-03 19:30:20 -0700 | [diff] [blame] | 1105 | public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags); |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 1106 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1107 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1108 | * Called from the input dispatcher thread before a key is dispatched to a window. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1109 | * |
| 1110 | * <p>Allows you to define |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1111 | * behavior for keys that can not be overridden by applications. |
| 1112 | * This method is called from the input thread, with no locks held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1113 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1114 | * @param win The window that currently has focus. This is where the key |
| 1115 | * event will normally go. |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 1116 | * @param event The key event. |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1117 | * @param policyFlags The policy flags associated with the key. |
Jeff Brown | d5bb82d | 2011-10-12 13:57:59 -0700 | [diff] [blame] | 1118 | * @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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1122 | */ |
Jeff Brown | d5bb82d | 2011-10-12 13:57:59 -0700 | [diff] [blame] | 1123 | public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1124 | |
| 1125 | /** |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1126 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1131 | * |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1132 | * @param win The window that currently has focus. This is where the key |
| 1133 | * event will normally go. |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 1134 | * @param event The key event. |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1135 | * @param policyFlags The policy flags associated with the key. |
Jeff Brown | 49ed71d | 2010-12-06 17:13:33 -0800 | [diff] [blame] | 1136 | * @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 Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1138 | */ |
Jeff Brown | 49ed71d | 2010-12-06 17:13:33 -0800 | [diff] [blame] | 1139 | public KeyEvent dispatchUnhandledKey(WindowState win, KeyEvent event, int policyFlags); |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1140 | |
| 1141 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1142 | * Called when layout of the windows is about to start. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1143 | * |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1144 | * @param displayFrames frames of the display we are doing layout on. |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 1145 | * @param uiMode The current uiMode in configuration. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1146 | */ |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1147 | default void beginLayoutLw(DisplayFrames displayFrames, int uiMode) {} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1148 | |
| 1149 | /** |
John Spurlock | 4664623 | 2013-09-30 22:32:42 -0400 | [diff] [blame] | 1150 | * Returns the bottom-most layer of the system decor, above which no policy decor should |
| 1151 | * be applied. |
Dianne Hackborn | 85afd1b | 2012-05-13 13:31:06 -0700 | [diff] [blame] | 1152 | */ |
John Spurlock | 4664623 | 2013-09-30 22:32:42 -0400 | [diff] [blame] | 1153 | public int getSystemDecorLayerLw(); |
Dianne Hackborn | 85afd1b | 2012-05-13 13:31:06 -0700 | [diff] [blame] | 1154 | |
| 1155 | /** |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1156 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1159 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1160 | * @param win The window being positioned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1161 | * @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 Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1164 | * @param displayFrames The display frames. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1165 | */ |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1166 | default void layoutWindowLw( |
| 1167 | WindowState win, WindowState attached, DisplayFrames displayFrames) {} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1168 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1169 | /** |
Adrian Roos | 9e370f2 | 2018-03-06 18:19:45 +0100 | [diff] [blame] | 1170 | * Return the layout hints for a newly added window. These values are computed on the |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1171 | * most recent layout, so they are not guaranteed to be correct. |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 1172 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1173 | * @param attrs The LayoutParams of the window. |
Jorim Jaggi | 23bf546 | 2016-05-13 15:24:39 -0700 | [diff] [blame] | 1174 | * @param taskBounds The bounds of the task this window is on or {@code null} if no task is |
| 1175 | * associated with the window. |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1176 | * @param displayFrames display frames. |
Adrian Roos | 5131181 | 2018-07-03 15:35:33 +0200 | [diff] [blame] | 1177 | * @param floatingStack Whether the window's stack is floating. |
Adrian Roos | 9e370f2 | 2018-03-06 18:19:45 +0100 | [diff] [blame] | 1178 | * @param outFrame The frame of the window. |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 1179 | * @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 Gruszczynski | 0ec1328 | 2015-06-25 11:26:01 -0700 | [diff] [blame] | 1182 | * @param outOutsets The areas that are not real display, but we would like to treat as such. |
Adrian Roos | 5c6b622 | 2017-11-07 17:36:10 +0100 | [diff] [blame] | 1183 | * @param outDisplayCutout The area that has been cut away from the display. |
Jorim Jaggi | 0ffd49c | 2016-02-12 15:04:21 -0800 | [diff] [blame] | 1184 | * @return Whether to always consume the navigation bar. |
| 1185 | * See {@link #isNavBarForcedShownLw(WindowState)}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1186 | */ |
Adrian Roos | 9e370f2 | 2018-03-06 18:19:45 +0100 | [diff] [blame] | 1187 | default boolean getLayoutHintLw(WindowManager.LayoutParams attrs, Rect taskBounds, |
Adrian Roos | 5131181 | 2018-07-03 15:35:33 +0200 | [diff] [blame] | 1188 | DisplayFrames displayFrames, boolean floatingStack, |
| 1189 | Rect outFrame, Rect outContentInsets, Rect outStableInsets, Rect outOutsets, |
Adrian Roos | 9e370f2 | 2018-03-06 18:19:45 +0100 | [diff] [blame] | 1190 | DisplayCutout.ParcelableWrapper outDisplayCutout) { |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1191 | return false; |
| 1192 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1193 | |
| 1194 | /** |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1195 | * Called following layout of all windows before each window has policy applied. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1196 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1197 | * @param displayWidth The current full width of the screen. |
| 1198 | * @param displayHeight The current full height of the screen. |
| 1199 | */ |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1200 | public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1201 | |
| 1202 | /** |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1203 | * Called following layout of all window to apply policy to each window. |
Yohei Yukawa | d1a0922 | 2015-06-30 16:22:05 -0700 | [diff] [blame] | 1204 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1205 | * @param win The window being positioned. |
Yohei Yukawa | d1a0922 | 2015-06-30 16:22:05 -0700 | [diff] [blame] | 1206 | * @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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1208 | */ |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1209 | public void applyPostLayoutPolicyLw(WindowState win, |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1210 | WindowManager.LayoutParams attrs, WindowState attached, WindowState imeTarget); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1211 | |
| 1212 | /** |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1213 | * 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 Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1217 | * |
Dianne Hackborn | b8b11a0 | 2010-03-10 15:53:11 -0800 | [diff] [blame] | 1218 | * @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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1221 | */ |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1222 | public int finishPostLayoutPolicyLw(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1223 | |
| 1224 | /** |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 1225 | * Return true if it is okay to perform animations for an app transition |
Jorim Jaggi | f84e2f6 | 2018-01-16 14:17:59 +0100 | [diff] [blame] | 1226 | * 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 Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 1228 | * immediately. |
| 1229 | */ |
| 1230 | public boolean allowAppAnimationsLw(); |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1231 | |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1232 | /** |
| 1233 | * A new window has been focused. |
| 1234 | */ |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 1235 | public int focusChangedLw(WindowState lastFocus, WindowState newFocus); |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 1236 | |
| 1237 | /** |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 1238 | * Called when the device has started waking up. |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 1239 | */ |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 1240 | public void startedWakingUp(); |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 1241 | |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 1242 | /** |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 1243 | * Called when the device has finished waking up. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1244 | */ |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 1245 | 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1262 | |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 1263 | /** |
| 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 Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1274 | /** |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 1275 | * 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 Jaggi | 51304d7 | 2017-05-17 17:25:32 +0200 | [diff] [blame] | 1281 | * 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 Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1290 | * Called when the device has turned the screen off. |
| 1291 | */ |
| 1292 | public void screenTurnedOff(); |
| 1293 | |
Dianne Hackborn | 38e29a6 | 2011-09-18 14:43:08 -0700 | [diff] [blame] | 1294 | public interface ScreenOnListener { |
| 1295 | void onScreenOn(); |
Craig Mautner | 61ac6bb | 2012-02-02 17:29:33 -0800 | [diff] [blame] | 1296 | } |
Dianne Hackborn | 38e29a6 | 2011-09-18 14:43:08 -0700 | [diff] [blame] | 1297 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1298 | /** |
Jorim Jaggi | 51304d7 | 2017-05-17 17:25:32 +0200 | [diff] [blame] | 1299 | * See {@link #screenTurnedOff} |
| 1300 | */ |
| 1301 | public interface ScreenOffListener { |
| 1302 | void onScreenOff(); |
| 1303 | } |
| 1304 | |
| 1305 | /** |
Jeff Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1306 | * Return whether the default display is on and not blocked by a black surface. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1307 | */ |
Jeff Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1308 | public boolean isScreenOn(); |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1309 | |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 1310 | /** |
Adrian Roos | 7c89480 | 2017-07-19 12:25:34 +0200 | [diff] [blame] | 1311 | * @return whether the device is currently allowed to animate. |
Adrian Roos | e94c15c | 2017-05-09 13:17:54 -0700 | [diff] [blame] | 1312 | * |
Adrian Roos | 7c89480 | 2017-07-19 12:25:34 +0200 | [diff] [blame] | 1313 | * 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 Roos | e94c15c | 2017-05-09 13:17:54 -0700 | [diff] [blame] | 1315 | */ |
Adrian Roos | 7c89480 | 2017-07-19 12:25:34 +0200 | [diff] [blame] | 1316 | boolean okToAnimate(); |
Adrian Roos | e94c15c | 2017-05-09 13:17:54 -0700 | [diff] [blame] | 1317 | |
| 1318 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1319 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1322 | */ |
Jeff Brown | 46b9ac0 | 2010-04-22 18:58:52 -0700 | [diff] [blame] | 1323 | public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen); |
Michael Wright | 3818c92 | 2014-09-02 13:59:07 -0700 | [diff] [blame] | 1324 | |
| 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1332 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1333 | * 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 Mautner | 3c17437 | 2013-02-21 17:54:37 -0800 | [diff] [blame] | 1341 | @SuppressWarnings("javadoc") |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1342 | public void enableKeyguard(boolean enabled); |
| 1343 | |
| 1344 | /** |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 1345 | * Callback used by {@link #exitKeyguardSecurely} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1346 | */ |
| 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 Mautner | 3c17437 | 2013-02-21 17:54:37 -0800 | [diff] [blame] | 1357 | @SuppressWarnings("javadoc") |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1358 | void exitKeyguardSecurely(OnKeyguardExitResult callback); |
| 1359 | |
| 1360 | /** |
Mike Lockwood | 520d8bc | 2011-02-18 13:23:13 -0500 | [diff] [blame] | 1361 | * 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 Miller | e4044bb | 2016-05-10 18:38:25 -0700 | [diff] [blame] | 1373 | * @param userId |
Mike Lockwood | 520d8bc | 2011-02-18 13:23:13 -0500 | [diff] [blame] | 1374 | * |
| 1375 | * @return true if in keyguard is secure. |
| 1376 | */ |
Jim Miller | e4044bb | 2016-05-10 18:38:25 -0700 | [diff] [blame] | 1377 | public boolean isKeyguardSecure(int userId); |
Mike Lockwood | 520d8bc | 2011-02-18 13:23:13 -0500 | [diff] [blame] | 1378 | |
| 1379 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1380 | * Return whether the keyguard is currently occluded. |
Adrian Roos | 461829d | 2015-06-03 14:41:18 -0700 | [diff] [blame] | 1381 | * |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1382 | * @return true if in keyguard is occluded, false otherwise |
Adrian Roos | 461829d | 2015-06-03 14:41:18 -0700 | [diff] [blame] | 1383 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1384 | public boolean isKeyguardOccluded(); |
Adrian Roos | 461829d | 2015-06-03 14:41:18 -0700 | [diff] [blame] | 1385 | |
| 1386 | /** |
Tony Mak | 2c0d6dc | 2016-04-29 16:16:54 +0100 | [diff] [blame] | 1387 | * @return true if in keyguard is on and not occluded. |
| 1388 | */ |
| 1389 | public boolean isKeyguardShowingAndNotOccluded(); |
| 1390 | |
| 1391 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1392 | * @return whether Keyguard is in trusted state and can be dismissed without credentials |
| 1393 | */ |
| 1394 | public boolean isKeyguardTrustedLw(); |
| 1395 | |
| 1396 | /** |
Siarhei Vishniakou | 35fbb31 | 2017-12-13 13:48:50 -0800 | [diff] [blame] | 1397 | * 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 Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 1408 | * Ask the policy to dismiss the keyguard, if it is currently shown. |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 1409 | * |
| 1410 | * @param callback Callback to be informed about the result. |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 1411 | * @param message A message that should be displayed in the keyguard. |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 1412 | */ |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 1413 | public void dismissKeyguardLw(@Nullable IKeyguardDismissCallback callback, |
| 1414 | CharSequence message); |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 1415 | |
| 1416 | /** |
Jorim Jaggi | cff0acb | 2014-03-31 16:35:15 +0200 | [diff] [blame] | 1417 | * 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 Jaggi | 77e1043 | 2016-10-26 17:43:56 -0700 | [diff] [blame] | 1424 | public boolean isShowingDreamLw(); |
| 1425 | |
Jorim Jaggi | cff0acb | 2014-03-31 16:35:15 +0200 | [diff] [blame] | 1426 | /** |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 1427 | * Called when the system is mostly done booting to set whether |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1428 | * the system should go into safe mode. |
| 1429 | */ |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 1430 | public void setSafeMode(boolean safeMode); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1431 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1432 | /** |
| 1433 | * Called when the system is mostly done booting. |
| 1434 | */ |
| 1435 | public void systemReady(); |
| 1436 | |
| 1437 | /** |
Dianne Hackborn | ba24e4d | 2011-09-01 11:17:06 -0700 | [diff] [blame] | 1438 | * 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 Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 1444 | * 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 Lockwood | ef73162 | 2010-01-27 17:51:34 -0500 | [diff] [blame] | 1454 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1460 | * Called when we have finished booting and can now display the home |
Jeff Brown | c042ee2 | 2012-05-08 13:03:42 -0700 | [diff] [blame] | 1461 | * screen to the user. This will happen after systemReady(), and at |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1462 | * this point the display is active. |
| 1463 | */ |
| 1464 | public void enableScreenAfterBoot(); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1465 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1466 | /** |
| 1467 | * Call from application to perform haptic feedback on its window. |
| 1468 | */ |
Alexey Kuzmin | e1f06b8 | 2018-06-20 17:48:43 +0100 | [diff] [blame] | 1469 | public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always, |
| 1470 | String reason); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1471 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1472 | /** |
Daniel Sandler | 0601eb7 | 2011-04-13 01:01:32 -0400 | [diff] [blame] | 1473 | * Called when we have started keeping the screen on because a window |
| 1474 | * requesting this has become visible. |
| 1475 | */ |
Jeff Brown | c38c9be | 2012-10-04 13:16:19 -0700 | [diff] [blame] | 1476 | public void keepScreenOnStartedLw(); |
Daniel Sandler | 0601eb7 | 2011-04-13 01:01:32 -0400 | [diff] [blame] | 1477 | |
| 1478 | /** |
| 1479 | * Called when we have stopped keeping the screen on because the last window |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1480 | * requesting this is no longer visible. |
| 1481 | */ |
Jeff Brown | c38c9be | 2012-10-04 13:16:19 -0700 | [diff] [blame] | 1482 | public void keepScreenOnStoppedLw(); |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 1483 | |
| 1484 | /** |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 1485 | * Called when a new system UI visibility is being reported, allowing |
| 1486 | * the policy to adjust what is actually reported. |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1487 | * @param visibility The raw visibility reported by the status bar. |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 1488 | * @return The new desired visibility. |
| 1489 | */ |
| 1490 | public int adjustSystemUiVisibilityLw(int visibility); |
| 1491 | |
| 1492 | /** |
Winson | ab21660 | 2016-08-09 14:05:20 -0700 | [diff] [blame] | 1493 | * 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 Chung | ac52f28 | 2017-03-30 14:44:52 -0700 | [diff] [blame] | 1500 | void setPipVisibilityLw(boolean visible); |
Winson | ab21660 | 2016-08-09 14:05:20 -0700 | [diff] [blame] | 1501 | |
| 1502 | /** |
Matthew Ng | 64543e6 | 2018-02-28 17:35:10 -0800 | [diff] [blame] | 1503 | * Called by System UI to enable or disable haptic feedback on the navigation bar buttons. |
| 1504 | */ |
| 1505 | void setNavBarVirtualKeyHapticFeedbackEnabledLw(boolean enabled); |
| 1506 | |
| 1507 | /** |
Daniel Sandler | 0c4ccff | 2011-10-19 16:39:14 -0400 | [diff] [blame] | 1508 | * Specifies whether there is an on-screen navigation bar separate from the status bar. |
| 1509 | */ |
| 1510 | public boolean hasNavigationBar(); |
| 1511 | |
| 1512 | /** |
Jim Miller | 93c518e | 2012-01-17 15:55:31 -0800 | [diff] [blame] | 1513 | * Lock the device now. |
| 1514 | */ |
Adam Cohen | f752202 | 2012-10-03 20:03:18 -0700 | [diff] [blame] | 1515 | public void lockNow(Bundle options); |
Jim Miller | 93c518e | 2012-01-17 15:55:31 -0800 | [diff] [blame] | 1516 | |
| 1517 | /** |
Yohei Yukawa | d6475a6 | 2017-04-17 10:35:27 -0700 | [diff] [blame] | 1518 | * 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 Mautner | 84984fa | 2014-06-19 11:19:20 -0700 | [diff] [blame] | 1530 | * Show the recents task list app. |
| 1531 | * @hide |
| 1532 | */ |
Winson Chung | dff7a73 | 2017-12-11 12:17:06 -0800 | [diff] [blame] | 1533 | public void showRecentApps(); |
Craig Mautner | 84984fa | 2014-06-19 11:19:20 -0700 | [diff] [blame] | 1534 | |
| 1535 | /** |
Alan Viverette | e34560b2 | 2014-07-10 14:50:06 -0700 | [diff] [blame] | 1536 | * Show the global actions dialog. |
| 1537 | * @hide |
| 1538 | */ |
| 1539 | public void showGlobalActions(); |
| 1540 | |
| 1541 | /** |
Craig Mautner | f1b6741 | 2012-09-19 13:18:29 -0700 | [diff] [blame] | 1542 | * 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 Ganov | 1cf70bb | 2012-08-06 10:53:34 -0700 | [diff] [blame] | 1548 | |
| 1549 | /** |
Evan Rosky | 1839645 | 2016-07-27 15:19:37 -0700 | [diff] [blame] | 1550 | * 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 Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 1559 | * Print the WindowManagerPolicy's state into the given stream. |
| 1560 | * |
| 1561 | * @param prefix Text to print at the front of each line. |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 1562 | * @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 Brown | d7a04de | 2012-06-17 14:17:52 -0700 | [diff] [blame] | 1566 | public void dump(String prefix, PrintWriter writer, String[] args); |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 1567 | |
| 1568 | /** |
Steven Timotius | af03df6 | 2017-07-18 16:56:43 -0700 | [diff] [blame] | 1569 | * Write the WindowManagerPolicy's state into the protocol buffer. |
Yi Jin | 6c6e9ca | 2018-03-20 16:53:35 -0700 | [diff] [blame] | 1570 | * The message is described in {@link com.android.server.wm.WindowManagerPolicyProto} |
Steven Timotius | af03df6 | 2017-07-18 16:56:43 -0700 | [diff] [blame] | 1571 | * |
| 1572 | * @param proto The protocol buffer output stream to write to. |
| 1573 | */ |
| 1574 | void writeToProto(ProtoOutputStream proto, long fieldId); |
| 1575 | |
| 1576 | /** |
Svetoslav Ganov | 545252f | 2012-12-10 18:29:24 -0800 | [diff] [blame] | 1577 | * 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 Jaggi | 0d67462 | 2014-05-21 01:34:15 +0200 | [diff] [blame] | 1586 | |
| 1587 | /** |
| 1588 | * Notifies the keyguard to start fading out. |
Jorim Jaggi | e29b2db | 2014-05-30 23:17:03 +0200 | [diff] [blame] | 1589 | * |
| 1590 | * @param startTime the start time of the animation in uptime milliseconds |
| 1591 | * @param fadeoutDuration the duration of the exit animation, in milliseconds |
Jorim Jaggi | 0d67462 | 2014-05-21 01:34:15 +0200 | [diff] [blame] | 1592 | */ |
Jorim Jaggi | e29b2db | 2014-05-30 23:17:03 +0200 | [diff] [blame] | 1593 | public void startKeyguardExitAnimation(long startTime, long fadeoutDuration); |
Jorim Jaggi | 737af72 | 2015-12-31 10:42:27 +0100 | [diff] [blame] | 1594 | |
| 1595 | /** |
| 1596 | * Calculates the stable insets without running a layout. |
| 1597 | * |
| 1598 | * @param displayRotation the current display rotation |
Jorim Jaggi | 737af72 | 2015-12-31 10:42:27 +0100 | [diff] [blame] | 1599 | * @param displayWidth the current display width |
| 1600 | * @param displayHeight the current display height |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 1601 | * @param displayCutout the current display cutout |
Winson | 3e87474 | 2016-01-07 10:08:17 -0800 | [diff] [blame] | 1602 | * @param outInsets the insets to return |
Jorim Jaggi | 737af72 | 2015-12-31 10:42:27 +0100 | [diff] [blame] | 1603 | */ |
| 1604 | public void getStableInsetsLw(int displayRotation, int displayWidth, int displayHeight, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 1605 | DisplayCutout displayCutout, Rect outInsets); |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 1606 | |
Jorim Jaggi | 0ffd49c | 2016-02-12 15:04:21 -0800 | [diff] [blame] | 1607 | |
| 1608 | /** |
| 1609 | * @return true if the navigation bar is forced to stay visible |
| 1610 | */ |
| 1611 | public boolean isNavBarForcedShownLw(WindowState win); |
| 1612 | |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 1613 | /** |
Andrii Kulian | 3a1619d | 2017-07-07 14:38:09 -0700 | [diff] [blame] | 1614 | * @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 Yukawa | d0a66b2 | 2018-01-10 13:19:54 -0800 | [diff] [blame] | 1619 | @NavigationBarPosition |
Andrii Kulian | 3a1619d | 2017-07-07 14:38:09 -0700 | [diff] [blame] | 1620 | int getNavBarPosition(); |
| 1621 | |
| 1622 | /** |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 1623 | * 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 Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 1629 | * @param displayCutout the current display cutout |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 1630 | * @param outInsets the insets to return |
| 1631 | */ |
| 1632 | public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 1633 | DisplayCutout displayCutout, Rect outInsets); |
Jorim Jaggi | 5060bd8 | 2016-02-19 17:12:19 -0800 | [diff] [blame] | 1634 | |
| 1635 | /** |
Matthew Ng | 62c7846 | 2018-04-09 14:43:21 -0700 | [diff] [blame] | 1636 | * @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 Jaggi | 5060bd8 | 2016-02-19 17:12:19 -0800 | [diff] [blame] | 1641 | * @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 Ng | 62c7846 | 2018-04-09 14:43:21 -0700 | [diff] [blame] | 1644 | * If navigation bar is movable then the docked side would bias towards the |
| 1645 | * {@param originalDockSide}. |
Jorim Jaggi | 5060bd8 | 2016-02-19 17:12:19 -0800 | [diff] [blame] | 1646 | */ |
Matthew Ng | 62c7846 | 2018-04-09 14:43:21 -0700 | [diff] [blame] | 1647 | public boolean isDockSideAllowed(int dockSide, int originalDockSide, int displayWidth, |
| 1648 | int displayHeight, int displayRotation); |
Jorim Jaggi | 11c62e1 | 2016-04-05 20:41:21 -0700 | [diff] [blame] | 1649 | |
| 1650 | /** |
| 1651 | * Called when the configuration has changed, and it's safe to load new values from resources. |
| 1652 | */ |
Riddle Hsu | ad256a1 | 2018-07-18 16:11:30 +0800 | [diff] [blame] | 1653 | public void onConfigurationChanged(DisplayContentInfo displayContentInfo); |
Robert Carr | 6da3cc0 | 2016-06-16 15:17:07 -0700 | [diff] [blame] | 1654 | |
Riddle Hsu | ad256a1 | 2018-07-18 16:11:30 +0800 | [diff] [blame] | 1655 | public boolean shouldRotateSeamlessly(DisplayRotation displayRotation, |
| 1656 | int oldRotation, int newRotation); |
Keun-young Park | 4136d2d | 2017-05-08 14:51:59 -0700 | [diff] [blame] | 1657 | |
| 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 Wright | 1985976 | 2017-09-18 20:57:58 +0100 | [diff] [blame] | 1669 | |
| 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 Naka | e1bdfc82 | 2017-09-15 15:24:34 +0900 | [diff] [blame] | 1683 | |
| 1684 | /** |
Jordan Liu | c022876 | 2018-07-13 11:39:42 -0700 | [diff] [blame] | 1685 | * Requests that the WindowManager sends |
| 1686 | * WindowManagerPolicyConstants#ACTION_USER_ACTIVITY_NOTIFICATION on the next user activity. |
Yoshiaki Naka | e1bdfc82 | 2017-09-15 15:24:34 +0900 | [diff] [blame] | 1687 | */ |
| 1688 | public void requestUserActivityNotification(); |
Benjamin Franz | 3662b15 | 2018-01-16 17:23:44 +0000 | [diff] [blame] | 1689 | |
| 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); |
chaviw | 0e9fb13 | 2018-06-05 16:29:13 -0700 | [diff] [blame] | 1700 | |
| 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1707 | } |