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 | |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 66 | import android.Manifest; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 67 | import android.annotation.IntDef; |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 68 | import android.annotation.Nullable; |
Benjamin Franz | 3662b15 | 2018-01-16 17:23:44 +0000 | [diff] [blame] | 69 | import android.app.ActivityManager; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 70 | import android.content.Context; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 71 | import android.content.pm.ActivityInfo; |
Dianne Hackborn | 2f0b175 | 2011-05-31 17:59:49 -0700 | [diff] [blame] | 72 | import android.content.res.CompatibilityInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 73 | import android.content.res.Configuration; |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 74 | import android.graphics.Point; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 75 | import android.graphics.Rect; |
Adam Cohen | f752202 | 2012-10-03 20:03:18 -0700 | [diff] [blame] | 76 | import android.os.Bundle; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 77 | import android.os.IBinder; |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 78 | import android.os.Looper; |
Muyuan Li | 94ce94e | 2016-02-24 16:20:54 -0800 | [diff] [blame] | 79 | import android.os.RemoteException; |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 80 | import android.util.Slog; |
Steven Timotius | af03df6 | 2017-07-18 16:56:43 -0700 | [diff] [blame] | 81 | import android.util.proto.ProtoOutputStream; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 82 | import android.view.Display; |
Adrian Roos | 5c6b622 | 2017-11-07 17:36:10 +0100 | [diff] [blame] | 83 | import android.view.DisplayCutout; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 84 | import android.view.IApplicationToken; |
| 85 | import android.view.IWindowManager; |
| 86 | import android.view.InputEventReceiver; |
| 87 | import android.view.KeyEvent; |
| 88 | import android.view.Surface; |
| 89 | import android.view.WindowManager; |
| 90 | import android.view.WindowManagerGlobal; |
| 91 | import android.view.WindowManagerPolicyConstants; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 92 | import android.view.animation.Animation; |
Aurimas Liutikas | 67e2ae8 | 2016-10-11 18:17:42 -0700 | [diff] [blame] | 93 | |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 94 | import com.android.internal.policy.IKeyguardDismissCallback; |
Muyuan Li | 94ce94e | 2016-02-24 16:20:54 -0800 | [diff] [blame] | 95 | import com.android.internal.policy.IShortcutService; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 96 | import com.android.server.wm.DisplayFrames; |
Adrian Roos | 6a4fa0e | 2018-03-05 19:50:16 +0100 | [diff] [blame] | 97 | import com.android.server.wm.utils.WmDisplayCutout; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 98 | |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 99 | import java.io.PrintWriter; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 100 | import java.lang.annotation.Retention; |
| 101 | import java.lang.annotation.RetentionPolicy; |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 102 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 103 | /** |
| 104 | * This interface supplies all UI-specific behavior of the window manager. An |
| 105 | * instance of it is created by the window manager when it starts up, and allows |
| 106 | * customization of window layering, special window types, key dispatching, and |
| 107 | * layout. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 108 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 109 | * <p>Because this provides deep interaction with the system window manager, |
| 110 | * specific methods on this interface can be called from a variety of contexts |
| 111 | * with various restrictions on what they can do. These are encoded through |
| 112 | * a suffixes at the end of a method encoding the thread the method is called |
| 113 | * from and any locks that are held when it is being called; if no suffix |
| 114 | * is attached to a method, then it is not called with any locks and may be |
| 115 | * called from the main window manager thread or another thread calling into |
| 116 | * the window manager. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 117 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 118 | * <p>The current suffixes are: |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 119 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 120 | * <dl> |
| 121 | * <dt> Ti <dd> Called from the input thread. This is the thread that |
| 122 | * collects pending input events and dispatches them to the appropriate window. |
| 123 | * It may block waiting for events to be processed, so that the input stream is |
| 124 | * properly serialized. |
| 125 | * <dt> Tq <dd> Called from the low-level input queue thread. This is the |
| 126 | * thread that reads events out of the raw input devices and places them |
| 127 | * into the global input queue that is read by the <var>Ti</var> thread. |
| 128 | * This thread should not block for a long period of time on anything but the |
| 129 | * key driver. |
| 130 | * <dt> Lw <dd> Called with the main window manager lock held. Because the |
| 131 | * window manager is a very low-level system service, there are few other |
| 132 | * system services you can call with this lock held. It is explicitly okay to |
| 133 | * 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] | 134 | * 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] | 135 | * {@link android.content.Context#checkPermission(String, int, int)} and |
| 136 | * variations require calling into the activity manager. |
| 137 | * <dt> Li <dd> Called with the input thread lock held. This lock can be |
| 138 | * acquired by the window manager while it holds the window lock, so this is |
| 139 | * even more restrictive than <var>Lw</var>. |
| 140 | * </dl> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 141 | */ |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 142 | public interface WindowManagerPolicy extends WindowManagerPolicyConstants { |
Yohei Yukawa | d0a66b2 | 2018-01-10 13:19:54 -0800 | [diff] [blame] | 143 | @Retention(SOURCE) |
| 144 | @IntDef({NAV_BAR_LEFT, NAV_BAR_RIGHT, NAV_BAR_BOTTOM}) |
| 145 | @interface NavigationBarPosition {} |
| 146 | |
Bryce Lee | 01b0c5f | 2015-02-05 18:24:04 -0800 | [diff] [blame] | 147 | /** |
Jeff Brown | d5bb82d | 2011-10-12 13:57:59 -0700 | [diff] [blame] | 148 | * Pass this event to the user / app. To be returned from |
| 149 | * {@link #interceptKeyBeforeQueueing}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 150 | */ |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 151 | int ACTION_PASS_TO_USER = 0x00000001; |
| 152 | /** Layout state may have changed (so another layout will be performed) */ |
| 153 | int FINISH_LAYOUT_REDO_LAYOUT = 0x0001; |
| 154 | /** Configuration state may have changed */ |
| 155 | int FINISH_LAYOUT_REDO_CONFIG = 0x0002; |
| 156 | /** Wallpaper may need to move */ |
| 157 | int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004; |
| 158 | /** Need to recompute animations */ |
| 159 | int FINISH_LAYOUT_REDO_ANIM = 0x0008; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 160 | |
| 161 | /** |
Muyuan Li | 94ce94e | 2016-02-24 16:20:54 -0800 | [diff] [blame] | 162 | * Register shortcuts for window manager to dispatch. |
| 163 | * Shortcut code is packed as (metaState << Integer.SIZE) | keyCode |
| 164 | * @hide |
| 165 | */ |
| 166 | void registerShortcutKey(long shortcutCode, IShortcutService shortcutKeyReceiver) |
| 167 | throws RemoteException; |
| 168 | |
| 169 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 170 | * Called when the Keyguard occluded state changed. |
| 171 | * @param occluded Whether Keyguard is currently occluded or not. |
Adrian Roos | d88eb26 | 2016-08-04 14:50:48 -0700 | [diff] [blame] | 172 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 173 | void onKeyguardOccludedChangedLw(boolean occluded); |
Adrian Roos | d88eb26 | 2016-08-04 14:50:48 -0700 | [diff] [blame] | 174 | |
| 175 | /** |
Adrian Roos | 2f1a90b | 2018-01-09 17:28:49 +0100 | [diff] [blame] | 176 | * Called when the resource overlays change. |
| 177 | */ |
| 178 | default void onOverlayChangedLw() {} |
| 179 | |
| 180 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 181 | * Interface to the Window Manager state associated with a particular |
| 182 | * window. You can hold on to an instance of this interface from the call |
| 183 | * to prepareAddWindow() until removeWindow(). |
| 184 | */ |
| 185 | public interface WindowState { |
| 186 | /** |
Dianne Hackborn | f265ea9 | 2013-01-31 15:00:51 -0800 | [diff] [blame] | 187 | * Return the uid of the app that owns this window. |
| 188 | */ |
| 189 | int getOwningUid(); |
| 190 | |
| 191 | /** |
| 192 | * Return the package name of the app that owns this window. |
| 193 | */ |
| 194 | String getOwningPackage(); |
| 195 | |
| 196 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 197 | * Perform standard frame computation. The result can be obtained with |
| 198 | * getFrame() if so desired. Must be called with the window manager |
| 199 | * lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 200 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 201 | * @param parentFrame The frame of the parent container this window |
| 202 | * is in, used for computing its basic position. |
| 203 | * @param displayFrame The frame of the overall display in which this |
| 204 | * window can appear, used for constraining the overall dimensions |
| 205 | * of the window. |
Dianne Hackborn | c4aad01 | 2013-02-22 15:05:25 -0800 | [diff] [blame] | 206 | * @param overlayFrame The frame within the display that is inside |
| 207 | * of the overlay region. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 208 | * @param contentFrame The frame within the display in which we would |
| 209 | * like active content to appear. This will cause windows behind to |
| 210 | * be resized to match the given content frame. |
| 211 | * @param visibleFrame The frame within the display that the window |
| 212 | * is actually visible, used for computing its visible insets to be |
| 213 | * given to windows behind. |
| 214 | * This can be used as a hint for scrolling (avoiding resizing) |
| 215 | * the window to make certain that parts of its content |
| 216 | * are visible. |
John Spurlock | 4664623 | 2013-09-30 22:32:42 -0400 | [diff] [blame] | 217 | * @param decorFrame The decor frame specified by policy specific to this window, |
| 218 | * to use for proper cropping during animation. |
Adrian Roos | fa10423 | 2014-06-20 16:10:14 -0700 | [diff] [blame] | 219 | * @param stableFrame The frame around which stable system decoration is positioned. |
Filip Gruszczynski | 2217f61 | 2015-05-26 11:32:08 -0700 | [diff] [blame] | 220 | * @param outsetFrame The frame that includes areas that aren't part of the surface but we |
| 221 | * want to treat them as such. |
Adrian Roos | 6a4fa0e | 2018-03-05 19:50:16 +0100 | [diff] [blame] | 222 | * @param displayCutout the display cutout |
Adrian Roos | 5ed644f | 2018-03-19 17:01:05 +0100 | [diff] [blame] | 223 | * @param parentFrameWasClippedByDisplayCutout true if the parent frame would have been |
| 224 | * different if there was no display cutout. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 225 | */ |
| 226 | public void computeFrameLw(Rect parentFrame, Rect displayFrame, |
Adrian Roos | fa10423 | 2014-06-20 16:10:14 -0700 | [diff] [blame] | 227 | Rect overlayFrame, Rect contentFrame, Rect visibleFrame, Rect decorFrame, |
Adrian Roos | 5ed644f | 2018-03-19 17:01:05 +0100 | [diff] [blame] | 228 | Rect stableFrame, @Nullable Rect outsetFrame, WmDisplayCutout displayCutout, |
| 229 | boolean parentFrameWasClippedByDisplayCutout); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 230 | |
| 231 | /** |
| 232 | * Retrieve the current frame of the window that has been assigned by |
| 233 | * the window manager. Must be called with the window manager lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 234 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 235 | * @return Rect The rectangle holding the window frame. |
| 236 | */ |
| 237 | public Rect getFrameLw(); |
| 238 | |
| 239 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 240 | * Retrieve the frame of the display that this window was last |
| 241 | * laid out in. Must be called with the |
| 242 | * window manager lock held. |
Dianne Hackborn | 5c58de3 | 2012-04-28 19:52:37 -0700 | [diff] [blame] | 243 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 244 | * @return Rect The rectangle holding the display frame. |
| 245 | */ |
| 246 | public Rect getDisplayFrameLw(); |
| 247 | |
| 248 | /** |
Dianne Hackborn | c4aad01 | 2013-02-22 15:05:25 -0800 | [diff] [blame] | 249 | * Retrieve the frame of the area inside the overscan region of the |
| 250 | * display that this window was last laid out in. Must be called with the |
| 251 | * window manager lock held. |
| 252 | * |
| 253 | * @return Rect The rectangle holding the display overscan frame. |
| 254 | */ |
| 255 | public Rect getOverscanFrameLw(); |
| 256 | |
| 257 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 258 | * Retrieve the frame of the content area that this window was last |
| 259 | * laid out in. This is the area in which the content of the window |
| 260 | * should be placed. It will be smaller than the display frame to |
| 261 | * account for screen decorations such as a status bar or soft |
| 262 | * keyboard. 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 rectangle holding the content frame. |
| 266 | */ |
| 267 | public Rect getContentFrameLw(); |
| 268 | |
| 269 | /** |
| 270 | * Retrieve the frame of the visible area that this window was last |
| 271 | * laid out in. This is the area of the screen in which the window |
| 272 | * will actually be fully visible. It will be smaller than the |
| 273 | * content frame to account for transient UI elements blocking it |
| 274 | * such as an input method's candidates UI. Must be called with the |
| 275 | * window manager lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 276 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 277 | * @return Rect The rectangle holding the visible frame. |
| 278 | */ |
| 279 | public Rect getVisibleFrameLw(); |
| 280 | |
| 281 | /** |
| 282 | * Returns true if this window is waiting to receive its given |
| 283 | * internal insets from the client app, and so should not impact the |
| 284 | * layout of other windows. |
| 285 | */ |
| 286 | public boolean getGivenInsetsPendingLw(); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 287 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 288 | /** |
| 289 | * Retrieve the insets given by this window's client for the content |
| 290 | * area of windows behind it. Must be called with the |
| 291 | * window manager lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 292 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 293 | * @return Rect The left, top, right, and bottom insets, relative |
| 294 | * to the window's frame, of the actual contents. |
| 295 | */ |
| 296 | public Rect getGivenContentInsetsLw(); |
| 297 | |
| 298 | /** |
| 299 | * Retrieve the insets given by this window's client for the visible |
| 300 | * area of windows behind it. Must be called with the |
| 301 | * window manager lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 302 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 303 | * @return Rect The left, top, right, and bottom insets, relative |
| 304 | * to the window's frame, of the actual visible area. |
| 305 | */ |
| 306 | public Rect getGivenVisibleInsetsLw(); |
| 307 | |
| 308 | /** |
| 309 | * Retrieve the current LayoutParams of the window. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 310 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 311 | * @return WindowManager.LayoutParams The window's internal LayoutParams |
| 312 | * instance. |
| 313 | */ |
| 314 | public WindowManager.LayoutParams getAttrs(); |
| 315 | |
| 316 | /** |
Dianne Hackborn | 73ab6a4 | 2011-12-13 11:16:23 -0800 | [diff] [blame] | 317 | * Return whether this window needs the menu key shown. Must be called |
| 318 | * with window lock held, because it may need to traverse down through |
| 319 | * window list to determine the result. |
| 320 | * @param bottom The bottom-most window to consider when determining this. |
| 321 | */ |
| 322 | public boolean getNeedsMenuLw(WindowState bottom); |
| 323 | |
| 324 | /** |
Dianne Hackborn | 9a230e0 | 2011-10-06 11:51:27 -0700 | [diff] [blame] | 325 | * Retrieve the current system UI visibility flags associated with |
| 326 | * this window. |
| 327 | */ |
| 328 | public int getSystemUiVisibility(); |
| 329 | |
| 330 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 331 | * Get the layer at which this window's surface will be Z-ordered. |
| 332 | */ |
| 333 | public int getSurfaceLayer(); |
Selim Cinek | d662361 | 2015-05-22 18:56:22 -0700 | [diff] [blame] | 334 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 335 | /** |
Selim Cinek | d662361 | 2015-05-22 18:56:22 -0700 | [diff] [blame] | 336 | * Retrieve the type of the top-level window. |
| 337 | * |
| 338 | * @return the base type of the parent window if attached or its own type otherwise |
| 339 | */ |
| 340 | public int getBaseType(); |
| 341 | |
| 342 | /** |
| 343 | * Return the token for the application (actually activity) that owns |
| 344 | * this window. May return null for system windows. |
| 345 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 346 | * @return An IApplicationToken identifying the owning activity. |
| 347 | */ |
| 348 | public IApplicationToken getAppToken(); |
| 349 | |
| 350 | /** |
Dianne Hackborn | e30e02f | 2014-05-27 18:24:45 -0700 | [diff] [blame] | 351 | * Return true if this window is participating in voice interaction. |
| 352 | */ |
| 353 | public boolean isVoiceInteraction(); |
| 354 | |
| 355 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 356 | * Return true if, at any point, the application token associated with |
| 357 | * this window has actually displayed any windows. This is most useful |
| 358 | * with the "starting up" window to determine if any windows were |
| 359 | * displayed when it is closed. |
| 360 | * |
| 361 | * @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] | 362 | * else false. |
| 363 | */ |
| 364 | public boolean hasAppShownWindows(); |
| 365 | |
| 366 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 367 | * Is this window visible? It is not visible if there is no |
| 368 | * surface, or we are in the process of running an exit animation |
| 369 | * that will remove the surface. |
| 370 | */ |
| 371 | boolean isVisibleLw(); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 372 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 373 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 374 | * Is this window currently visible to the user on-screen? It is |
| 375 | * 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] | 376 | * animation before no longer being visible. Must be called with the |
| 377 | * window manager lock held. |
| 378 | */ |
| 379 | boolean isDisplayedLw(); |
| 380 | |
| 381 | /** |
Dianne Hackborn | 5c58de3 | 2012-04-28 19:52:37 -0700 | [diff] [blame] | 382 | * Return true if this window (or a window it is attached to, but not |
| 383 | * considering its app token) is currently animating. |
| 384 | */ |
Filip Gruszczynski | 14b4e57 | 2015-11-03 15:53:55 -0800 | [diff] [blame] | 385 | boolean isAnimatingLw(); |
Dianne Hackborn | 5c58de3 | 2012-04-28 19:52:37 -0700 | [diff] [blame] | 386 | |
| 387 | /** |
Jorim Jaggi | 23cc9aa | 2017-05-23 16:05:35 +0200 | [diff] [blame] | 388 | * @return Whether the window can affect SystemUI flags, meaning that SystemUI (system bars, |
| 389 | * for example) will be affected by the flags specified in this window. This is the |
| 390 | * case when the surface is on screen but not exiting. |
| 391 | */ |
| 392 | boolean canAffectSystemUiFlags(); |
| 393 | |
| 394 | /** |
Dianne Hackborn | 01b02a7 | 2012-01-12 14:05:03 -0800 | [diff] [blame] | 395 | * Is this window considered to be gone for purposes of layout? |
| 396 | */ |
| 397 | boolean isGoneForLayoutLw(); |
| 398 | |
| 399 | /** |
Adrian Roos | 76d2fe4 | 2015-07-09 14:54:08 -0700 | [diff] [blame] | 400 | * Returns true if the window has a surface that it has drawn a |
| 401 | * complete UI in to. Note that this is different from {@link #hasDrawnLw()} |
| 402 | * in that it also returns true if the window is READY_TO_SHOW, but was not yet |
| 403 | * promoted to HAS_DRAWN. |
| 404 | */ |
| 405 | boolean isDrawnLw(); |
| 406 | |
| 407 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 408 | * 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] | 409 | * the past. Must be called with the window manager lock held. |
Jorim Jaggi | a32da38 | 2018-03-28 18:01:22 +0200 | [diff] [blame] | 410 | * |
| 411 | * @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] | 412 | */ |
Jorim Jaggi | a32da38 | 2018-03-28 18:01:22 +0200 | [diff] [blame] | 413 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 414 | public boolean hasDrawnLw(); |
| 415 | |
| 416 | /** |
| 417 | * Can be called by the policy to force a window to be hidden, |
| 418 | * regardless of whether the client or window manager would like |
| 419 | * it shown. Must be called with the window manager lock held. |
| 420 | * Returns true if {@link #showLw} was last called for the window. |
| 421 | */ |
| 422 | public boolean hideLw(boolean doAnimation); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 423 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 424 | /** |
| 425 | * Can be called to undo the effect of {@link #hideLw}, allowing a |
| 426 | * window to be shown as long as the window manager and client would |
| 427 | * also like it to be shown. Must be called with the window manager |
| 428 | * lock held. |
| 429 | * Returns true if {@link #hideLw} was last called for the window. |
| 430 | */ |
| 431 | public boolean showLw(boolean doAnimation); |
Dianne Hackborn | f87d196 | 2012-04-04 12:48:24 -0700 | [diff] [blame] | 432 | |
| 433 | /** |
| 434 | * Check whether the process hosting this window is currently alive. |
| 435 | */ |
| 436 | public boolean isAlive(); |
Craig Mautner | 69b0818 | 2012-09-05 13:07:13 -0700 | [diff] [blame] | 437 | |
| 438 | /** |
| 439 | * Check if window is on {@link Display#DEFAULT_DISPLAY}. |
| 440 | * @return true if window is on default display. |
| 441 | */ |
| 442 | public boolean isDefaultDisplay(); |
Adrian Roos | cd3884d | 2015-02-18 17:25:23 +0100 | [diff] [blame] | 443 | |
| 444 | /** |
| 445 | * Check whether the window is currently dimming. |
| 446 | */ |
| 447 | public boolean isDimming(); |
Jorim Jaggi | 8690558 | 2016-02-09 21:36:09 -0800 | [diff] [blame] | 448 | |
Adrian Roos | 865c70f | 2018-01-10 17:32:27 +0100 | [diff] [blame] | 449 | /** |
| 450 | * Returns true if the window is letterboxed for the display cutout. |
| 451 | */ |
| 452 | default boolean isLetterboxedForDisplayCutoutLw() { |
| 453 | return false; |
| 454 | } |
| 455 | |
Adrian Roos | 23df3a3 | 2018-03-15 15:41:13 +0100 | [diff] [blame] | 456 | /** |
| 457 | * Returns true if the window has a letterbox and any part of that letterbox overlaps with |
| 458 | * the given {@code rect}. |
| 459 | */ |
| 460 | default boolean isLetterboxedOverlappingWith(Rect rect) { |
| 461 | return false; |
| 462 | } |
| 463 | |
Wale Ogunwale | 44f036f | 2017-09-29 05:09:09 -0700 | [diff] [blame] | 464 | /** @return the current windowing mode of this window. */ |
| 465 | int getWindowingMode(); |
Wale Ogunwale | 9185fb0 | 2016-03-11 18:06:14 -0800 | [diff] [blame] | 466 | |
| 467 | /** |
| 468 | * Returns true if the window is current in multi-windowing mode. i.e. it shares the |
| 469 | * screen with other application windows. |
| 470 | */ |
Andrii Kulian | 933076d | 2016-03-29 17:04:42 -0700 | [diff] [blame] | 471 | public boolean isInMultiWindowMode(); |
Robert Carr | fd10cd1 | 2016-06-29 16:41:50 -0700 | [diff] [blame] | 472 | |
| 473 | public int getRotationAnimationHint(); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 474 | |
| 475 | public boolean isInputMethodWindow(); |
| 476 | |
Robert Carr | 825581a | 2018-03-30 14:00:53 -0700 | [diff] [blame] | 477 | public boolean isInputMethodTarget(); |
| 478 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 479 | public int getDisplayId(); |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 480 | |
| 481 | /** |
| 482 | * Returns true if the window owner can add internal system windows. |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 483 | * That is, they have {@link Manifest.permission#INTERNAL_SYSTEM_WINDOW}. |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 484 | */ |
| 485 | default boolean canAddInternalSystemWindow() { |
| 486 | return false; |
| 487 | } |
Jorim Jaggi | f12ec0f | 2017-08-23 16:14:10 +0200 | [diff] [blame] | 488 | |
| 489 | /** |
| 490 | * 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] | 491 | * visible. That is, they have the permission {@link Manifest.permission#DEVICE_POWER}. |
Jorim Jaggi | f12ec0f | 2017-08-23 16:14:10 +0200 | [diff] [blame] | 492 | */ |
| 493 | boolean canAcquireSleepToken(); |
Vishnu Nair | 9a3e406 | 2018-01-11 08:42:54 -0800 | [diff] [blame] | 494 | |
| 495 | /** |
Yi Jin | 6c6e9ca | 2018-03-20 16:53:35 -0700 | [diff] [blame] | 496 | * Writes {@link com.android.server.wm.IdentifierProto} to stream. |
Vishnu Nair | 9a3e406 | 2018-01-11 08:42:54 -0800 | [diff] [blame] | 497 | */ |
| 498 | void writeIdentifierToProto(ProtoOutputStream proto, long fieldId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 499 | } |
| 500 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 501 | /** |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 502 | * Representation of a input consumer that the policy has added to the |
| 503 | * window manager to consume input events going to windows below it. |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 504 | */ |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 505 | public interface InputConsumer { |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 506 | /** |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 507 | * Remove the input consumer from the window manager. |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 508 | */ |
| 509 | void dismiss(); |
| 510 | } |
| 511 | |
| 512 | /** |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 513 | * Holds the contents of a starting window. {@link #addSplashScreen} needs to wrap the |
| 514 | * 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] | 515 | * held by WM and released with {@link #remove} when no longer needed. |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 516 | */ |
| 517 | interface StartingSurface { |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 518 | |
| 519 | /** |
| 520 | * Removes the starting window surface. Do not hold the window manager lock when calling |
| 521 | * this method! |
| 522 | */ |
| 523 | void remove(); |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 524 | } |
| 525 | |
| 526 | /** |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 527 | * Interface for calling back in to the window manager that is private |
| 528 | * between it and the policy. |
| 529 | */ |
| 530 | public interface WindowManagerFuncs { |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 531 | public static final int LID_ABSENT = -1; |
| 532 | public static final int LID_CLOSED = 0; |
| 533 | public static final int LID_OPEN = 1; |
| 534 | |
Michael Wright | 3818c92 | 2014-09-02 13:59:07 -0700 | [diff] [blame] | 535 | public static final int CAMERA_LENS_COVER_ABSENT = -1; |
| 536 | public static final int CAMERA_LENS_UNCOVERED = 0; |
| 537 | public static final int CAMERA_LENS_COVERED = 1; |
| 538 | |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 539 | /** |
| 540 | * Ask the window manager to re-evaluate the system UI flags. |
| 541 | */ |
| 542 | public void reevaluateStatusBarVisibility(); |
| 543 | |
| 544 | /** |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 545 | * 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] | 546 | */ |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 547 | public InputConsumer createInputConsumer(Looper looper, String name, |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 548 | InputEventReceiver.Factory inputEventReceiverFactory); |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 549 | |
| 550 | /** |
| 551 | * Returns a code that describes the current state of the lid switch. |
| 552 | */ |
| 553 | public int getLidState(); |
| 554 | |
| 555 | /** |
Edward Savage-Jones | 7def60d | 2015-11-13 13:27:03 +0100 | [diff] [blame] | 556 | * Lock the device now. |
| 557 | */ |
| 558 | public void lockDeviceNow(); |
| 559 | |
| 560 | /** |
Michael Wright | 3818c92 | 2014-09-02 13:59:07 -0700 | [diff] [blame] | 561 | * Returns a code that descripbes whether the camera lens is covered or not. |
| 562 | */ |
| 563 | public int getCameraLensCoverState(); |
| 564 | |
| 565 | /** |
Yohei Yukawa | 2d9accb | 2018-03-07 19:15:15 -0800 | [diff] [blame] | 566 | * Switch the keyboard layout for the given device. |
| 567 | * Direction should be +1 or -1 to go to the next or previous keyboard layout. |
| 568 | */ |
| 569 | public void switchKeyboardLayout(int deviceId, int direction); |
| 570 | |
| 571 | /** |
Yohei Yukawa | ae61f71 | 2015-12-09 13:00:10 -0800 | [diff] [blame] | 572 | * Switch the input method, to be precise, input method subtype. |
| 573 | * |
| 574 | * @param forwardDirection {@code true} to rotate in a forward direction. |
| 575 | */ |
| 576 | public void switchInputMethod(boolean forwardDirection); |
| 577 | |
Jeff Brown | 9a538ee | 2012-08-20 14:56:57 -0700 | [diff] [blame] | 578 | public void shutdown(boolean confirm); |
Alison Cichowlas | f8eca40 | 2016-08-05 14:50:27 -0400 | [diff] [blame] | 579 | public void reboot(boolean confirm); |
Jeff Brown | 9a538ee | 2012-08-20 14:56:57 -0700 | [diff] [blame] | 580 | public void rebootSafeMode(boolean confirm); |
John Spurlock | 04db176 | 2013-05-13 12:46:41 -0400 | [diff] [blame] | 581 | |
| 582 | /** |
| 583 | * Return the window manager lock needed to correctly call "Lw" methods. |
| 584 | */ |
| 585 | public Object getWindowManagerLock(); |
Craig Mautner | 037aa8d | 2013-06-07 10:35:44 -0700 | [diff] [blame] | 586 | |
| 587 | /** Register a system listener for touch events */ |
| 588 | void registerPointerEventListener(PointerEventListener listener); |
| 589 | |
| 590 | /** Unregister a system listener for touch events */ |
| 591 | void unregisterPointerEventListener(PointerEventListener listener); |
Jorim Jaggi | 81ba11e | 2016-02-03 22:04:22 -0800 | [diff] [blame] | 592 | |
| 593 | /** |
| 594 | * @return The content insets of the docked divider window. |
| 595 | */ |
| 596 | int getDockedDividerInsetsLw(); |
Jorim Jaggi | 8690558 | 2016-02-09 21:36:09 -0800 | [diff] [blame] | 597 | |
| 598 | /** |
Wale Ogunwale | 6827856 | 2017-09-23 17:13:55 -0700 | [diff] [blame] | 599 | * Retrieves the {@param outBounds} from the stack matching the {@param windowingMode} and |
| 600 | * {@param activityType}. |
Jorim Jaggi | 8690558 | 2016-02-09 21:36:09 -0800 | [diff] [blame] | 601 | */ |
Wale Ogunwale | 6827856 | 2017-09-23 17:13:55 -0700 | [diff] [blame] | 602 | void getStackBounds(int windowingMode, int activityType, Rect outBounds); |
Jorim Jaggi | 77e1043 | 2016-10-26 17:43:56 -0700 | [diff] [blame] | 603 | |
| 604 | /** |
| 605 | * Notifies window manager that {@link #isShowingDreamLw} has changed. |
| 606 | */ |
| 607 | void notifyShowingDreamChanged(); |
Jorim Jaggi | e69c931 | 2016-10-31 18:24:38 -0700 | [diff] [blame] | 608 | |
| 609 | /** |
Jorim Jaggi | 40db029 | 2016-06-27 17:58:03 -0700 | [diff] [blame] | 610 | * @return The currently active input method window. |
| 611 | */ |
| 612 | WindowState getInputMethodWindowLw(); |
| 613 | |
| 614 | /** |
Jorim Jaggi | e69c931 | 2016-10-31 18:24:38 -0700 | [diff] [blame] | 615 | * Notifies window manager that {@link #isKeyguardTrustedLw} has changed. |
| 616 | */ |
| 617 | void notifyKeyguardTrustedChanged(); |
Jorim Jaggi | 51304d7 | 2017-05-17 17:25:32 +0200 | [diff] [blame] | 618 | |
| 619 | /** |
| 620 | * Notifies the window manager that screen is being turned off. |
| 621 | * |
| 622 | * @param listener callback to call when display can be turned off |
| 623 | */ |
| 624 | void screenTurningOff(ScreenOffListener listener); |
Michael Wright | 1985976 | 2017-09-18 20:57:58 +0100 | [diff] [blame] | 625 | |
| 626 | /** |
| 627 | * Convert the lid state to a human readable format. |
| 628 | */ |
| 629 | static String lidStateToString(int lid) { |
| 630 | switch (lid) { |
| 631 | case LID_ABSENT: |
| 632 | return "LID_ABSENT"; |
| 633 | case LID_CLOSED: |
| 634 | return "LID_CLOSED"; |
| 635 | case LID_OPEN: |
| 636 | return "LID_OPEN"; |
| 637 | default: |
| 638 | return Integer.toString(lid); |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | /** |
| 643 | * Convert the camera lens state to a human readable format. |
| 644 | */ |
| 645 | static String cameraLensStateToString(int lens) { |
| 646 | switch (lens) { |
| 647 | case CAMERA_LENS_COVER_ABSENT: |
| 648 | return "CAMERA_LENS_COVER_ABSENT"; |
| 649 | case CAMERA_LENS_UNCOVERED: |
| 650 | return "CAMERA_LENS_UNCOVERED"; |
| 651 | case CAMERA_LENS_COVERED: |
| 652 | return "CAMERA_LENS_COVERED"; |
| 653 | default: |
| 654 | return Integer.toString(lens); |
| 655 | } |
| 656 | } |
Adrian Roos | 842e788 | 2018-03-26 17:34:06 +0200 | [diff] [blame] | 657 | |
| 658 | /** |
| 659 | * Hint to window manager that the user has started a navigation action that should |
| 660 | * abort animations that have no timeout, in case they got stuck. |
| 661 | */ |
| 662 | void triggerAnimationFailsafe(); |
Adrian Roos | 4163d62 | 2018-05-22 16:56:35 +0200 | [diff] [blame] | 663 | |
| 664 | /** |
| 665 | * The keyguard showing state has changed |
| 666 | */ |
| 667 | void onKeyguardShowingAndNotOccludedChanged(); |
Craig Mautner | 037aa8d | 2013-06-07 10:35:44 -0700 | [diff] [blame] | 668 | } |
| 669 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 670 | /** Window has been added to the screen. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 671 | public static final int TRANSIT_ENTER = 1; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 672 | /** Window has been removed from the screen. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 673 | public static final int TRANSIT_EXIT = 2; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 674 | /** Window has been made visible. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 675 | public static final int TRANSIT_SHOW = 3; |
| 676 | /** Window has been made invisible. |
| 677 | * TODO: Consider removal as this is unused. */ |
| 678 | public static final int TRANSIT_HIDE = 4; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 679 | /** The "application starting" preview window is no longer needed, and will |
| 680 | * animate away to show the real window. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 681 | public static final int TRANSIT_PREVIEW_DONE = 5; |
| 682 | |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 683 | // NOTE: screen off reasons are in order of significance, with more |
| 684 | // important ones lower than less important ones. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 685 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 686 | /** @hide */ |
| 687 | @IntDef({USER_ROTATION_FREE, USER_ROTATION_LOCKED}) |
| 688 | @Retention(RetentionPolicy.SOURCE) |
| 689 | public @interface UserRotationMode {} |
| 690 | |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 691 | /** When not otherwise specified by the activity's screenOrientation, rotation should be |
| 692 | * determined by the system (that is, using sensors). */ |
| 693 | public final int USER_ROTATION_FREE = 0; |
| 694 | /** When not otherwise specified by the activity's screenOrientation, rotation is set by |
| 695 | * the user. */ |
| 696 | public final int USER_ROTATION_LOCKED = 1; |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 697 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 698 | /** |
| 699 | * Perform initialization of the policy. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 700 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 701 | * @param context The system context we are running in. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 702 | */ |
| 703 | public void init(Context context, IWindowManager windowManager, |
Jeff Brown | 9630704 | 2012-07-27 15:51:34 -0700 | [diff] [blame] | 704 | WindowManagerFuncs windowManagerFuncs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 705 | |
| 706 | /** |
Craig Mautner | 46ac6fa | 2013-08-01 10:06:34 -0700 | [diff] [blame] | 707 | * @return true if com.android.internal.R.bool#config_forceDefaultOrientation is true. |
| 708 | */ |
| 709 | public boolean isDefaultOrientationForced(); |
| 710 | |
| 711 | /** |
Dianne Hackborn | 9d13264 | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 712 | * Called by window manager once it has the initial, default native |
| 713 | * display dimensions. |
| 714 | */ |
Dianne Hackborn | dde331c | 2012-08-03 14:01:57 -0700 | [diff] [blame] | 715 | public void setInitialDisplaySize(Display display, int width, int height, int density); |
Dianne Hackborn | dacea8c | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 716 | |
Dianne Hackborn | 9d13264 | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 717 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 718 | * Check permissions when adding a window. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 719 | * |
Dianne Hackborn | c229302 | 2013-02-06 23:14:49 -0800 | [diff] [blame] | 720 | * @param attrs The window's LayoutParams. |
| 721 | * @param outAppOp First element will be filled with the app op corresponding to |
| 722 | * this window, or OP_NONE. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 723 | * |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 724 | * @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] | 725 | * else an error code, usually |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 726 | * {@link WindowManagerGlobal#ADD_PERMISSION_DENIED}, to abort the add. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 727 | */ |
Dianne Hackborn | c229302 | 2013-02-06 23:14:49 -0800 | [diff] [blame] | 728 | public int checkAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 729 | |
| 730 | /** |
Craig Mautner | 88400d3 | 2012-09-30 12:35:45 -0700 | [diff] [blame] | 731 | * Check permissions when adding a window. |
| 732 | * |
| 733 | * @param attrs The window's LayoutParams. |
| 734 | * |
| 735 | * @return True if the window may only be shown to the current user, false if the window can |
| 736 | * be shown on all users' windows. |
| 737 | */ |
| 738 | public boolean checkShowToOwnerOnly(WindowManager.LayoutParams attrs); |
| 739 | |
| 740 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 741 | * Sanitize the layout parameters coming from a client. Allows the policy |
| 742 | * to do things like ensure that windows of a specific type can't take |
| 743 | * input focus. |
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 | * @param attrs The window layout parameters to be modified. These values |
| 746 | * are modified in-place. |
| 747 | */ |
Wale Ogunwale | c0b0f93 | 2017-11-01 12:51:43 -0700 | [diff] [blame] | 748 | public void adjustWindowParamsLw(WindowState win, WindowManager.LayoutParams attrs, |
| 749 | boolean hasStatusBarServicePermission); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 750 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 751 | /** |
| 752 | * After the window manager has computed the current configuration based |
| 753 | * on its knowledge of the display and input devices, it gives the policy |
| 754 | * a chance to adjust the information contained in it. If you want to |
| 755 | * leave it as-is, simply do nothing. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 756 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 757 | * <p>This method may be called by any thread in the window manager, but |
| 758 | * no internal locks in the window manager will be held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 759 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 760 | * @param config The Configuration being computed, for you to change as |
| 761 | * desired. |
Jeff Brown | daa3753 | 2012-05-01 15:54:03 -0700 | [diff] [blame] | 762 | * @param keyboardPresence Flags that indicate whether internal or external |
| 763 | * keyboards are present. |
| 764 | * @param navigationPresence Flags that indicate whether internal or external |
| 765 | * navigation devices are present. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 766 | */ |
Jeff Brown | daa3753 | 2012-05-01 15:54:03 -0700 | [diff] [blame] | 767 | public void adjustConfigurationLw(Configuration config, int keyboardPresence, |
| 768 | int navigationPresence); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 769 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 770 | /** |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 771 | * Returns the layer assignment for the window state. Allows you to control how different |
| 772 | * kinds of windows are ordered on-screen. |
| 773 | * |
| 774 | * @param win The window state |
| 775 | * @return int An arbitrary integer used to order windows, with lower numbers below higher ones. |
| 776 | */ |
| 777 | default int getWindowLayerLw(WindowState win) { |
| 778 | return getWindowLayerFromTypeLw(win.getBaseType(), win.canAddInternalSystemWindow()); |
| 779 | } |
| 780 | |
| 781 | /** |
| 782 | * 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] | 783 | * kinds of windows are ordered on-screen. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 784 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 785 | * @param type The type of window being assigned. |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 786 | * @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] | 787 | */ |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 788 | default int getWindowLayerFromTypeLw(int type) { |
| 789 | if (isSystemAlertWindowType(type)) { |
| 790 | throw new IllegalArgumentException("Use getWindowLayerFromTypeLw() or" |
| 791 | + " getWindowLayerLw() for alert window types"); |
| 792 | } |
| 793 | return getWindowLayerFromTypeLw(type, false /* canAddInternalSystemWindow */); |
| 794 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 795 | |
| 796 | /** |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 797 | * Returns the layer assignment for the window type. Allows you to control how different |
| 798 | * kinds of windows are ordered on-screen. |
| 799 | * |
| 800 | * @param type The type of window being assigned. |
| 801 | * @param canAddInternalSystemWindow If the owner window associated with the type we are |
| 802 | * evaluating can add internal system windows. I.e they have |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 803 | * {@link Manifest.permission#INTERNAL_SYSTEM_WINDOW}. If true, alert window |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 804 | * types {@link android.view.WindowManager.LayoutParams#isSystemAlertWindowType(int)} |
| 805 | * can be assigned layers greater than the layer for |
| 806 | * {@link android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY} Else, their |
| 807 | * layers would be lesser. |
| 808 | * @return int An arbitrary integer used to order windows, with lower numbers below higher ones. |
| 809 | */ |
| 810 | default int getWindowLayerFromTypeLw(int type, boolean canAddInternalSystemWindow) { |
| 811 | if (type >= FIRST_APPLICATION_WINDOW && type <= LAST_APPLICATION_WINDOW) { |
| 812 | return APPLICATION_LAYER; |
| 813 | } |
| 814 | |
| 815 | switch (type) { |
| 816 | case TYPE_WALLPAPER: |
| 817 | // wallpaper is at the bottom, though the window manager may move it. |
| 818 | return 1; |
| 819 | case TYPE_PRESENTATION: |
| 820 | case TYPE_PRIVATE_PRESENTATION: |
| 821 | return APPLICATION_LAYER; |
| 822 | case TYPE_DOCK_DIVIDER: |
| 823 | return APPLICATION_LAYER; |
| 824 | case TYPE_QS_DIALOG: |
| 825 | return APPLICATION_LAYER; |
| 826 | case TYPE_PHONE: |
| 827 | return 3; |
| 828 | case TYPE_SEARCH_BAR: |
| 829 | case TYPE_VOICE_INTERACTION_STARTING: |
| 830 | return 4; |
| 831 | case TYPE_VOICE_INTERACTION: |
| 832 | // voice interaction layer is almost immediately above apps. |
| 833 | return 5; |
| 834 | case TYPE_INPUT_CONSUMER: |
| 835 | return 6; |
| 836 | case TYPE_SYSTEM_DIALOG: |
| 837 | return 7; |
| 838 | case TYPE_TOAST: |
| 839 | // toasts and the plugged-in battery thing |
| 840 | return 8; |
| 841 | case TYPE_PRIORITY_PHONE: |
| 842 | // SIM errors and unlock. Not sure if this really should be in a high layer. |
| 843 | return 9; |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 844 | case TYPE_SYSTEM_ALERT: |
| 845 | // like the ANR / app crashed dialogs |
| 846 | return canAddInternalSystemWindow ? 11 : 10; |
| 847 | case TYPE_APPLICATION_OVERLAY: |
Wale Ogunwale | d993a57 | 2017-02-05 13:52:09 -0800 | [diff] [blame] | 848 | return 12; |
| 849 | case TYPE_DREAM: |
| 850 | // used for Dreams (screensavers with TYPE_DREAM windows) |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 851 | return 13; |
| 852 | case TYPE_INPUT_METHOD: |
| 853 | // on-screen keyboards and other such input method user interfaces go here. |
| 854 | return 14; |
| 855 | case TYPE_INPUT_METHOD_DIALOG: |
| 856 | // on-screen keyboards and other such input method user interfaces go here. |
| 857 | return 15; |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 858 | case TYPE_STATUS_BAR: |
Robert Carr | 8360a78 | 2017-11-22 12:47:58 -0800 | [diff] [blame] | 859 | return 17; |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 860 | case TYPE_STATUS_BAR_PANEL: |
Robert Carr | 8360a78 | 2017-11-22 12:47:58 -0800 | [diff] [blame] | 861 | return 18; |
| 862 | case TYPE_STATUS_BAR_SUB_PANEL: |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 863 | return 19; |
| 864 | case TYPE_KEYGUARD_DIALOG: |
| 865 | return 20; |
| 866 | case TYPE_VOLUME_OVERLAY: |
| 867 | // the on-screen volume indicator and controller shown when the user |
| 868 | // changes the device volume |
| 869 | return 21; |
| 870 | case TYPE_SYSTEM_OVERLAY: |
| 871 | // the on-screen volume indicator and controller shown when the user |
| 872 | // changes the device volume |
| 873 | return canAddInternalSystemWindow ? 22 : 11; |
| 874 | case TYPE_NAVIGATION_BAR: |
| 875 | // the navigation bar, if available, shows atop most things |
| 876 | return 23; |
| 877 | case TYPE_NAVIGATION_BAR_PANEL: |
| 878 | // some panels (e.g. search) need to show on top of the navigation bar |
| 879 | return 24; |
| 880 | case TYPE_SCREENSHOT: |
| 881 | // screenshot selection layer shouldn't go above system error, but it should cover |
| 882 | // navigation bars at the very least. |
| 883 | return 25; |
| 884 | case TYPE_SYSTEM_ERROR: |
| 885 | // system-level error dialogs |
| 886 | return canAddInternalSystemWindow ? 26 : 10; |
| 887 | case TYPE_MAGNIFICATION_OVERLAY: |
| 888 | // used to highlight the magnified portion of a display |
| 889 | return 27; |
| 890 | case TYPE_DISPLAY_OVERLAY: |
| 891 | // used to simulate secondary display devices |
| 892 | return 28; |
| 893 | case TYPE_DRAG: |
| 894 | // the drag layer: input for drag-and-drop is associated with this window, |
| 895 | // which sits above all other focusable windows |
| 896 | return 29; |
| 897 | case TYPE_ACCESSIBILITY_OVERLAY: |
| 898 | // overlay put by accessibility services to intercept user interaction |
| 899 | return 30; |
| 900 | case TYPE_SECURE_SYSTEM_OVERLAY: |
| 901 | return 31; |
| 902 | case TYPE_BOOT_PROGRESS: |
| 903 | return 32; |
| 904 | case TYPE_POINTER: |
| 905 | // the (mouse) pointer layer |
| 906 | return 33; |
| 907 | default: |
| 908 | Slog.e("WindowManager", "Unknown window type: " + type); |
| 909 | return APPLICATION_LAYER; |
| 910 | } |
| 911 | } |
| 912 | |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 913 | /** |
| 914 | * Return how to Z-order sub-windows in relation to the window they are attached to. |
| 915 | * Return positive to have them ordered in front, negative for behind. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 916 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 917 | * @param type The sub-window type code. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 918 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 919 | * @return int Layer in relation to the attached window, where positive is |
| 920 | * above and negative is below. |
| 921 | */ |
Wale Ogunwale | 5cd907d | 2017-01-26 14:14:08 -0800 | [diff] [blame] | 922 | default int getSubWindowLayerFromTypeLw(int type) { |
| 923 | switch (type) { |
| 924 | case TYPE_APPLICATION_PANEL: |
| 925 | case TYPE_APPLICATION_ATTACHED_DIALOG: |
| 926 | return APPLICATION_PANEL_SUBLAYER; |
| 927 | case TYPE_APPLICATION_MEDIA: |
| 928 | return APPLICATION_MEDIA_SUBLAYER; |
| 929 | case TYPE_APPLICATION_MEDIA_OVERLAY: |
| 930 | return APPLICATION_MEDIA_OVERLAY_SUBLAYER; |
| 931 | case TYPE_APPLICATION_SUB_PANEL: |
| 932 | return APPLICATION_SUB_PANEL_SUBLAYER; |
| 933 | case TYPE_APPLICATION_ABOVE_SUB_PANEL: |
| 934 | return APPLICATION_ABOVE_SUB_PANEL_SUBLAYER; |
| 935 | } |
| 936 | Slog.e("WindowManager", "Unknown sub-window type: " + type); |
| 937 | return 0; |
| 938 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 939 | |
| 940 | /** |
Dianne Hackborn | 6136b7e | 2009-09-18 01:53:49 -0700 | [diff] [blame] | 941 | * Get the highest layer (actually one more than) that the wallpaper is |
| 942 | * allowed to be in. |
| 943 | */ |
| 944 | public int getMaxWallpaperLayer(); |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 945 | |
| 946 | /** |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 947 | * Return the display width available after excluding any screen |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 948 | * 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] | 949 | * button bar. |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 950 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 951 | public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 952 | int uiMode, int displayId, DisplayCutout displayCutout); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 953 | |
| 954 | /** |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 955 | * Return the display height available after excluding any screen |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 956 | * 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] | 957 | * button bar. |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 958 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 959 | public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 960 | int uiMode, int displayId, DisplayCutout displayCutout); |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 961 | |
| 962 | /** |
| 963 | * Return the available screen width that we should report for the |
| 964 | * configuration. This must be no larger than |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 965 | * {@link #getNonDecorDisplayWidth(int, int, int, int, int, DisplayCutout)}; it may be smaller |
| 966 | * than that to account for more transient decoration like a status bar. |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 967 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 968 | public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 969 | int uiMode, int displayId, DisplayCutout displayCutout); |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 970 | |
| 971 | /** |
| 972 | * Return the available screen height that we should report for the |
| 973 | * configuration. This must be no larger than |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 974 | * {@link #getNonDecorDisplayHeight(int, int, int, int, int, DisplayCutout)}; it may be smaller |
| 975 | * than that to account for more transient decoration like a status bar. |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 976 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 977 | public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 978 | int uiMode, int displayId, DisplayCutout displayCutout); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 979 | |
| 980 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 981 | * Return whether the given window can become the Keyguard window. Typically returns true for |
| 982 | * the StatusBar. |
Jorim Jaggi | 0d67462 | 2014-05-21 01:34:15 +0200 | [diff] [blame] | 983 | */ |
| 984 | public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs); |
| 985 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 986 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 987 | * @return whether {@param win} can be hidden by Keyguard |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 988 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 989 | public boolean canBeHiddenByKeyguardLw(WindowState win); |
Craig Mautner | 7d7808f | 2014-09-11 18:02:38 -0700 | [diff] [blame] | 990 | |
| 991 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 992 | * Called when the system would like to show a UI to indicate that an |
| 993 | * application is starting. You can use this to add a |
| 994 | * APPLICATION_STARTING_TYPE window with the given appToken to the window |
| 995 | * manager (using the normal window manager APIs) that will be shown until |
| 996 | * the application displays its own window. This is called without the |
| 997 | * window manager locked so that you can call back into it. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 998 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 999 | * @param appToken Token of the application being started. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1000 | * @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] | 1001 | * @param theme Resource defining the application's overall visual theme. |
| 1002 | * @param nonLocalizedLabel The default title label of the application if |
| 1003 | * no data is found in the resource. |
| 1004 | * @param labelRes The resource ID the application would like to use as its name. |
| 1005 | * @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] | 1006 | * @param windowFlags Window layout flags. |
Wale Ogunwale | dfc1862 | 2016-04-16 15:08:48 -0700 | [diff] [blame] | 1007 | * @param overrideConfig override configuration to consider when generating |
| 1008 | * context to for resources. |
Andrii Kulian | fb1bf69 | 2017-01-17 11:17:34 -0800 | [diff] [blame] | 1009 | * @param displayId Id of the display to show the splash screen at. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1010 | * |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 1011 | * @return The starting surface. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1012 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1013 | */ |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 1014 | public StartingSurface addSplashScreen(IBinder appToken, String packageName, int theme, |
| 1015 | CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, |
Andrii Kulian | fb1bf69 | 2017-01-17 11:17:34 -0800 | [diff] [blame] | 1016 | int logo, int windowFlags, Configuration overrideConfig, int displayId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1017 | |
| 1018 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1019 | * Prepare for a window being added to the window manager. You can throw an |
| 1020 | * exception here to prevent the window being added, or do whatever setup |
| 1021 | * you need to keep track of the window. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1022 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1023 | * @param win The window being added. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1024 | * @param attrs The window's LayoutParams. |
| 1025 | * |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 1026 | * @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] | 1027 | * error code to abort the add. |
| 1028 | */ |
| 1029 | public int prepareAddWindowLw(WindowState win, |
| 1030 | WindowManager.LayoutParams attrs); |
| 1031 | |
| 1032 | /** |
| 1033 | * Called when a window is being removed from a window manager. Must not |
| 1034 | * throw an exception -- clean up as much as possible. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1035 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1036 | * @param win The window being removed. |
| 1037 | */ |
| 1038 | public void removeWindowLw(WindowState win); |
| 1039 | |
| 1040 | /** |
| 1041 | * Control the animation to run when a window's state changes. Return a |
| 1042 | * non-0 number to force the animation to a specific resource ID, or 0 |
| 1043 | * to use the default animation. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1044 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1045 | * @param win The window that is changing. |
| 1046 | * @param transit What is happening to the window: {@link #TRANSIT_ENTER}, |
| 1047 | * {@link #TRANSIT_EXIT}, {@link #TRANSIT_SHOW}, or |
| 1048 | * {@link #TRANSIT_HIDE}. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1049 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1050 | * @return Resource ID of the actual animation to use, or 0 for none. |
| 1051 | */ |
| 1052 | public int selectAnimationLw(WindowState win, int transit); |
| 1053 | |
| 1054 | /** |
Craig Mautner | 3c17437 | 2013-02-21 17:54:37 -0800 | [diff] [blame] | 1055 | * Determine the animation to run for a rotation transition based on the |
| 1056 | * top fullscreen windows {@link WindowManager.LayoutParams#rotationAnimation} |
| 1057 | * and whether it is currently fullscreen and frontmost. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1058 | * |
| 1059 | * @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] | 1060 | * entering animation resource id is stored in anim[1]. |
| 1061 | */ |
| 1062 | public void selectRotationAnimationLw(int anim[]); |
| 1063 | |
| 1064 | /** |
| 1065 | * Validate whether the current top fullscreen has specified the same |
| 1066 | * {@link WindowManager.LayoutParams#rotationAnimation} value as that |
| 1067 | * being passed in from the previous top fullscreen window. |
| 1068 | * |
| 1069 | * @param exitAnimId exiting resource id from the previous window. |
| 1070 | * @param enterAnimId entering resource id from the previous window. |
| 1071 | * @param forceDefault For rotation animations only, if true ignore the |
| 1072 | * animation values and just return false. |
| 1073 | * @return true if the previous values are still valid, false if they |
| 1074 | * should be replaced with the default. |
| 1075 | */ |
| 1076 | public boolean validateRotationAnimationLw(int exitAnimId, int enterAnimId, |
| 1077 | boolean forceDefault); |
| 1078 | |
| 1079 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1080 | * 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] | 1081 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1082 | public Animation createHiddenByKeyguardExit(boolean onWallpaper, |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 1083 | boolean goingToNotificationShade); |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 1084 | |
| 1085 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1086 | * Create and return an animation to let the wallpaper disappear after being shown behind |
| 1087 | * Keyguard. |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 1088 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1089 | public Animation createKeyguardWallpaperExit(boolean goingToNotificationShade); |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 1090 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 1091 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1092 | * 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] | 1093 | * |
| 1094 | * <p>There are some actions that need to be handled here because they |
| 1095 | * affect the power state of the device, for example, the power keys. |
| 1096 | * Generally, it's best to keep as little as possible in the queue thread |
| 1097 | * because it's the most fragile. |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 1098 | * @param event The key event. |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1099 | * @param policyFlags The policy flags associated with the key. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1100 | * |
Jeff Brown | 2687550 | 2014-01-30 21:47:47 -0800 | [diff] [blame] | 1101 | * @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] | 1102 | */ |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 1103 | public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags); |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 1104 | |
| 1105 | /** |
Michael Wright | 70af00a | 2014-09-03 19:30:20 -0700 | [diff] [blame] | 1106 | * Called from the input reader thread before a motion is enqueued when the device is in a |
| 1107 | * non-interactive state. |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 1108 | * |
| 1109 | * <p>There are some actions that need to be handled here because they |
| 1110 | * affect the power state of the device, for example, waking on motions. |
| 1111 | * Generally, it's best to keep as little as possible in the queue thread |
| 1112 | * because it's the most fragile. |
| 1113 | * @param policyFlags The policy flags associated with the motion. |
| 1114 | * |
Jeff Brown | 2687550 | 2014-01-30 21:47:47 -0800 | [diff] [blame] | 1115 | * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}. |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 1116 | */ |
Michael Wright | 70af00a | 2014-09-03 19:30:20 -0700 | [diff] [blame] | 1117 | public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags); |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 1118 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1119 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1120 | * 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] | 1121 | * |
| 1122 | * <p>Allows you to define |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1123 | * behavior for keys that can not be overridden by applications. |
| 1124 | * This method is called from the input thread, with no locks held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1125 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1126 | * @param win The window that currently has focus. This is where the key |
| 1127 | * event will normally go. |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 1128 | * @param event The key event. |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1129 | * @param policyFlags The policy flags associated with the key. |
Jeff Brown | d5bb82d | 2011-10-12 13:57:59 -0700 | [diff] [blame] | 1130 | * @return 0 if the key should be dispatched immediately, -1 if the key should |
| 1131 | * not be dispatched ever, or a positive value indicating the number of |
| 1132 | * milliseconds by which the key dispatch should be delayed before trying |
| 1133 | * again. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1134 | */ |
Jeff Brown | d5bb82d | 2011-10-12 13:57:59 -0700 | [diff] [blame] | 1135 | public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1136 | |
| 1137 | /** |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1138 | * Called from the input dispatcher thread when an application did not handle |
| 1139 | * a key that was dispatched to it. |
| 1140 | * |
| 1141 | * <p>Allows you to define default global behavior for keys that were not handled |
| 1142 | * 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] | 1143 | * |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1144 | * @param win The window that currently has focus. This is where the key |
| 1145 | * event will normally go. |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 1146 | * @param event The key event. |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1147 | * @param policyFlags The policy flags associated with the key. |
Jeff Brown | 49ed71d | 2010-12-06 17:13:33 -0800 | [diff] [blame] | 1148 | * @return Returns an alternate key event to redispatch as a fallback, or null to give up. |
| 1149 | * The caller is responsible for recycling the key event. |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1150 | */ |
Jeff Brown | 49ed71d | 2010-12-06 17:13:33 -0800 | [diff] [blame] | 1151 | public KeyEvent dispatchUnhandledKey(WindowState win, KeyEvent event, int policyFlags); |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 1152 | |
| 1153 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1154 | * Called when layout of the windows is about to start. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1155 | * |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1156 | * @param displayFrames frames of the display we are doing layout on. |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 1157 | * @param uiMode The current uiMode in configuration. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1158 | */ |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1159 | default void beginLayoutLw(DisplayFrames displayFrames, int uiMode) {} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1160 | |
| 1161 | /** |
John Spurlock | 4664623 | 2013-09-30 22:32:42 -0400 | [diff] [blame] | 1162 | * Returns the bottom-most layer of the system decor, above which no policy decor should |
| 1163 | * be applied. |
Dianne Hackborn | 85afd1b | 2012-05-13 13:31:06 -0700 | [diff] [blame] | 1164 | */ |
John Spurlock | 4664623 | 2013-09-30 22:32:42 -0400 | [diff] [blame] | 1165 | public int getSystemDecorLayerLw(); |
Dianne Hackborn | 85afd1b | 2012-05-13 13:31:06 -0700 | [diff] [blame] | 1166 | |
| 1167 | /** |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1168 | * Called for each window attached to the window manager as layout is proceeding. The |
| 1169 | * implementation of this function must take care of setting the window's frame, either here or |
| 1170 | * in finishLayout(). |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1171 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1172 | * @param win The window being positioned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1173 | * @param attached For sub-windows, the window it is attached to; this |
| 1174 | * window will already have had layoutWindow() called on it |
| 1175 | * so you can use its Rect. Otherwise null. |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1176 | * @param displayFrames The display frames. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1177 | */ |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1178 | default void layoutWindowLw( |
| 1179 | WindowState win, WindowState attached, DisplayFrames displayFrames) {} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1180 | |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1181 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1182 | /** |
Adrian Roos | 9e370f2 | 2018-03-06 18:19:45 +0100 | [diff] [blame] | 1183 | * 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] | 1184 | * most recent layout, so they are not guaranteed to be correct. |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 1185 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1186 | * @param attrs The LayoutParams of the window. |
Jorim Jaggi | 23bf546 | 2016-05-13 15:24:39 -0700 | [diff] [blame] | 1187 | * @param taskBounds The bounds of the task this window is on or {@code null} if no task is |
| 1188 | * associated with the window. |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1189 | * @param displayFrames display frames. |
Adrian Roos | 9e370f2 | 2018-03-06 18:19:45 +0100 | [diff] [blame] | 1190 | * @param outFrame The frame of the window. |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 1191 | * @param outContentInsets The areas covered by system windows, expressed as positive insets. |
| 1192 | * @param outStableInsets The areas covered by stable system windows irrespective of their |
| 1193 | * current visibility. Expressed as positive insets. |
Filip Gruszczynski | 0ec1328 | 2015-06-25 11:26:01 -0700 | [diff] [blame] | 1194 | * @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] | 1195 | * @param outDisplayCutout The area that has been cut away from the display. |
Jorim Jaggi | 0ffd49c | 2016-02-12 15:04:21 -0800 | [diff] [blame] | 1196 | * @return Whether to always consume the navigation bar. |
| 1197 | * See {@link #isNavBarForcedShownLw(WindowState)}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1198 | */ |
Adrian Roos | 9e370f2 | 2018-03-06 18:19:45 +0100 | [diff] [blame] | 1199 | default boolean getLayoutHintLw(WindowManager.LayoutParams attrs, Rect taskBounds, |
| 1200 | DisplayFrames displayFrames, Rect outFrame, Rect outContentInsets, |
| 1201 | Rect outStableInsets, Rect outOutsets, |
| 1202 | DisplayCutout.ParcelableWrapper outDisplayCutout) { |
Wale Ogunwale | 828ff7e | 2017-11-14 01:01:29 +0000 | [diff] [blame] | 1203 | return false; |
| 1204 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1205 | |
| 1206 | /** |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1207 | * Called following layout of all windows before each window has policy applied. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1208 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1209 | * @param displayWidth The current full width of the screen. |
| 1210 | * @param displayHeight The current full height of the screen. |
| 1211 | */ |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1212 | public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1213 | |
| 1214 | /** |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1215 | * Called following layout of all window to apply policy to each window. |
Yohei Yukawa | d1a0922 | 2015-06-30 16:22:05 -0700 | [diff] [blame] | 1216 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1217 | * @param win The window being positioned. |
Yohei Yukawa | d1a0922 | 2015-06-30 16:22:05 -0700 | [diff] [blame] | 1218 | * @param attrs The LayoutParams of the window. |
| 1219 | * @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] | 1220 | */ |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1221 | public void applyPostLayoutPolicyLw(WindowState win, |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1222 | WindowManager.LayoutParams attrs, WindowState attached, WindowState imeTarget); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1223 | |
| 1224 | /** |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1225 | * Called following layout of all windows and after policy has been applied |
| 1226 | * to each window. If in this function you do |
| 1227 | * something that may have modified the animation state of another window, |
| 1228 | * 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] | 1229 | * |
Dianne Hackborn | b8b11a0 | 2010-03-10 15:53:11 -0800 | [diff] [blame] | 1230 | * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT}, |
| 1231 | * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER}, |
| 1232 | * or {@link #FINISH_LAYOUT_REDO_ANIM}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1233 | */ |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 1234 | public int finishPostLayoutPolicyLw(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1235 | |
| 1236 | /** |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 1237 | * 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] | 1238 | * that is about to occur. You may return false for this if, for example, |
| 1239 | * the dream window is currently displayed so the switch should happen |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 1240 | * immediately. |
| 1241 | */ |
| 1242 | public boolean allowAppAnimationsLw(); |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1243 | |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 1244 | /** |
| 1245 | * A new window has been focused. |
| 1246 | */ |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 1247 | public int focusChangedLw(WindowState lastFocus, WindowState newFocus); |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 1248 | |
| 1249 | /** |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 1250 | * Called when the device has started waking up. |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 1251 | */ |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 1252 | public void startedWakingUp(); |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 1253 | |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 1254 | /** |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 1255 | * Called when the device has finished waking up. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1256 | */ |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 1257 | public void finishedWakingUp(); |
| 1258 | |
| 1259 | /** |
| 1260 | * Called when the device has started going to sleep. |
| 1261 | * |
| 1262 | * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN}, |
| 1263 | * or {@link #OFF_BECAUSE_OF_TIMEOUT}. |
| 1264 | */ |
| 1265 | public void startedGoingToSleep(int why); |
| 1266 | |
| 1267 | /** |
| 1268 | * Called when the device has finished going to sleep. |
| 1269 | * |
| 1270 | * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN}, |
| 1271 | * or {@link #OFF_BECAUSE_OF_TIMEOUT}. |
| 1272 | */ |
| 1273 | public void finishedGoingToSleep(int why); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1274 | |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 1275 | /** |
| 1276 | * Called when the device is about to turn on the screen to show content. |
| 1277 | * When waking up, this method will be called once after the call to wakingUp(). |
| 1278 | * When dozing, the method will be called sometime after the call to goingToSleep() and |
| 1279 | * may be called repeatedly in the case where the screen is pulsing on and off. |
| 1280 | * |
| 1281 | * Must call back on the listener to tell it when the higher-level system |
| 1282 | * is ready for the screen to go on (i.e. the lock screen is shown). |
| 1283 | */ |
| 1284 | public void screenTurningOn(ScreenOnListener screenOnListener); |
| 1285 | |
Jeff Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1286 | /** |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 1287 | * Called when the device has actually turned on the screen, i.e. the display power state has |
| 1288 | * been set to ON and the screen is unblocked. |
| 1289 | */ |
| 1290 | public void screenTurnedOn(); |
| 1291 | |
| 1292 | /** |
Jorim Jaggi | 51304d7 | 2017-05-17 17:25:32 +0200 | [diff] [blame] | 1293 | * Called when the display would like to be turned off. This gives policy a chance to do some |
| 1294 | * things before the display power state is actually changed to off. |
| 1295 | * |
| 1296 | * @param screenOffListener Must be called to tell that the display power state can actually be |
| 1297 | * changed now after policy has done its work. |
| 1298 | */ |
| 1299 | public void screenTurningOff(ScreenOffListener screenOffListener); |
| 1300 | |
| 1301 | /** |
Jeff Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1302 | * Called when the device has turned the screen off. |
| 1303 | */ |
| 1304 | public void screenTurnedOff(); |
| 1305 | |
Dianne Hackborn | 38e29a6 | 2011-09-18 14:43:08 -0700 | [diff] [blame] | 1306 | public interface ScreenOnListener { |
| 1307 | void onScreenOn(); |
Craig Mautner | 61ac6bb | 2012-02-02 17:29:33 -0800 | [diff] [blame] | 1308 | } |
Dianne Hackborn | 38e29a6 | 2011-09-18 14:43:08 -0700 | [diff] [blame] | 1309 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1310 | /** |
Jorim Jaggi | 51304d7 | 2017-05-17 17:25:32 +0200 | [diff] [blame] | 1311 | * See {@link #screenTurnedOff} |
| 1312 | */ |
| 1313 | public interface ScreenOffListener { |
| 1314 | void onScreenOff(); |
| 1315 | } |
| 1316 | |
| 1317 | /** |
Jeff Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1318 | * 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] | 1319 | */ |
Jeff Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1320 | public boolean isScreenOn(); |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1321 | |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 1322 | /** |
Adrian Roos | 7c89480 | 2017-07-19 12:25:34 +0200 | [diff] [blame] | 1323 | * @return whether the device is currently allowed to animate. |
Adrian Roos | e94c15c | 2017-05-09 13:17:54 -0700 | [diff] [blame] | 1324 | * |
Adrian Roos | 7c89480 | 2017-07-19 12:25:34 +0200 | [diff] [blame] | 1325 | * Note: this can be true even if it is not appropriate to animate for reasons that are outside |
| 1326 | * of the policy's authority. |
Adrian Roos | e94c15c | 2017-05-09 13:17:54 -0700 | [diff] [blame] | 1327 | */ |
Adrian Roos | 7c89480 | 2017-07-19 12:25:34 +0200 | [diff] [blame] | 1328 | boolean okToAnimate(); |
Adrian Roos | e94c15c | 2017-05-09 13:17:54 -0700 | [diff] [blame] | 1329 | |
| 1330 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1331 | * Tell the policy that the lid switch has changed state. |
| 1332 | * @param whenNanos The time when the change occurred in uptime nanoseconds. |
| 1333 | * @param lidOpen True if the lid is now open. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1334 | */ |
Jeff Brown | 46b9ac0 | 2010-04-22 18:58:52 -0700 | [diff] [blame] | 1335 | public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen); |
Michael Wright | 3818c92 | 2014-09-02 13:59:07 -0700 | [diff] [blame] | 1336 | |
| 1337 | /** |
| 1338 | * Tell the policy that the camera lens has been covered or uncovered. |
| 1339 | * @param whenNanos The time when the change occurred in uptime nanoseconds. |
| 1340 | * @param lensCovered True if the lens is covered. |
| 1341 | */ |
| 1342 | public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered); |
| 1343 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1344 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1345 | * Tell the policy if anyone is requesting that keyguard not come on. |
| 1346 | * |
| 1347 | * @param enabled Whether keyguard can be on or not. does not actually |
| 1348 | * turn it on, unless it was previously disabled with this function. |
| 1349 | * |
| 1350 | * @see android.app.KeyguardManager.KeyguardLock#disableKeyguard() |
| 1351 | * @see android.app.KeyguardManager.KeyguardLock#reenableKeyguard() |
| 1352 | */ |
Craig Mautner | 3c17437 | 2013-02-21 17:54:37 -0800 | [diff] [blame] | 1353 | @SuppressWarnings("javadoc") |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1354 | public void enableKeyguard(boolean enabled); |
| 1355 | |
| 1356 | /** |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 1357 | * Callback used by {@link #exitKeyguardSecurely} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1358 | */ |
| 1359 | interface OnKeyguardExitResult { |
| 1360 | void onKeyguardExitResult(boolean success); |
| 1361 | } |
| 1362 | |
| 1363 | /** |
| 1364 | * Tell the policy if anyone is requesting the keyguard to exit securely |
| 1365 | * (this would be called after the keyguard was disabled) |
| 1366 | * @param callback Callback to send the result back. |
| 1367 | * @see android.app.KeyguardManager#exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult) |
| 1368 | */ |
Craig Mautner | 3c17437 | 2013-02-21 17:54:37 -0800 | [diff] [blame] | 1369 | @SuppressWarnings("javadoc") |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1370 | void exitKeyguardSecurely(OnKeyguardExitResult callback); |
| 1371 | |
| 1372 | /** |
Mike Lockwood | 520d8bc | 2011-02-18 13:23:13 -0500 | [diff] [blame] | 1373 | * isKeyguardLocked |
| 1374 | * |
| 1375 | * Return whether the keyguard is currently locked. |
| 1376 | * |
| 1377 | * @return true if in keyguard is locked. |
| 1378 | */ |
| 1379 | public boolean isKeyguardLocked(); |
| 1380 | |
| 1381 | /** |
| 1382 | * isKeyguardSecure |
| 1383 | * |
| 1384 | * Return whether the keyguard requires a password to unlock. |
Jim Miller | e4044bb | 2016-05-10 18:38:25 -0700 | [diff] [blame] | 1385 | * @param userId |
Mike Lockwood | 520d8bc | 2011-02-18 13:23:13 -0500 | [diff] [blame] | 1386 | * |
| 1387 | * @return true if in keyguard is secure. |
| 1388 | */ |
Jim Miller | e4044bb | 2016-05-10 18:38:25 -0700 | [diff] [blame] | 1389 | public boolean isKeyguardSecure(int userId); |
Mike Lockwood | 520d8bc | 2011-02-18 13:23:13 -0500 | [diff] [blame] | 1390 | |
| 1391 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1392 | * Return whether the keyguard is currently occluded. |
Adrian Roos | 461829d | 2015-06-03 14:41:18 -0700 | [diff] [blame] | 1393 | * |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1394 | * @return true if in keyguard is occluded, false otherwise |
Adrian Roos | 461829d | 2015-06-03 14:41:18 -0700 | [diff] [blame] | 1395 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1396 | public boolean isKeyguardOccluded(); |
Adrian Roos | 461829d | 2015-06-03 14:41:18 -0700 | [diff] [blame] | 1397 | |
| 1398 | /** |
Tony Mak | 2c0d6dc | 2016-04-29 16:16:54 +0100 | [diff] [blame] | 1399 | * @return true if in keyguard is on and not occluded. |
| 1400 | */ |
| 1401 | public boolean isKeyguardShowingAndNotOccluded(); |
| 1402 | |
| 1403 | /** |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 1404 | * @return whether Keyguard is in trusted state and can be dismissed without credentials |
| 1405 | */ |
| 1406 | public boolean isKeyguardTrustedLw(); |
| 1407 | |
| 1408 | /** |
Siarhei Vishniakou | 35fbb31 | 2017-12-13 13:48:50 -0800 | [diff] [blame] | 1409 | * inKeyguardRestrictedKeyInputMode |
| 1410 | * |
| 1411 | * If keyguard screen is showing or in restricted key input mode (i.e. in |
| 1412 | * keyguard password emergency screen). When in such mode, certain keys, |
| 1413 | * such as the Home key and the right soft keys, don't work. |
| 1414 | * |
| 1415 | * @return true if in keyguard restricted input mode. |
| 1416 | */ |
| 1417 | public boolean inKeyguardRestrictedKeyInputMode(); |
| 1418 | |
| 1419 | /** |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 1420 | * Ask the policy to dismiss the keyguard, if it is currently shown. |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 1421 | * |
| 1422 | * @param callback Callback to be informed about the result. |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 1423 | * @param message A message that should be displayed in the keyguard. |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 1424 | */ |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 1425 | public void dismissKeyguardLw(@Nullable IKeyguardDismissCallback callback, |
| 1426 | CharSequence message); |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 1427 | |
| 1428 | /** |
Jorim Jaggi | cff0acb | 2014-03-31 16:35:15 +0200 | [diff] [blame] | 1429 | * Ask the policy whether the Keyguard has drawn. If the Keyguard is disabled, this method |
| 1430 | * returns true as soon as we know that Keyguard is disabled. |
| 1431 | * |
| 1432 | * @return true if the keyguard has drawn. |
| 1433 | */ |
| 1434 | public boolean isKeyguardDrawnLw(); |
| 1435 | |
Jorim Jaggi | 77e1043 | 2016-10-26 17:43:56 -0700 | [diff] [blame] | 1436 | public boolean isShowingDreamLw(); |
| 1437 | |
Jorim Jaggi | cff0acb | 2014-03-31 16:35:15 +0200 | [diff] [blame] | 1438 | /** |
Jeff Brown | 01a98dd | 2011-09-20 15:08:29 -0700 | [diff] [blame] | 1439 | * Given an orientation constant, returns the appropriate surface rotation, |
| 1440 | * taking into account sensors, docking mode, rotation lock, and other factors. |
| 1441 | * |
| 1442 | * @param orientation An orientation constant, such as |
| 1443 | * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}. |
| 1444 | * @param lastRotation The most recently used rotation. |
Andrii Kulian | ef5ce1c | 2018-03-20 19:27:24 -0700 | [diff] [blame] | 1445 | * @param defaultDisplay Flag indicating whether the rotation is computed for the default |
| 1446 | * display. Currently for all non-default displays sensors, docking mode, |
| 1447 | * rotation lock and other factors are ignored. |
Jeff Brown | 01a98dd | 2011-09-20 15:08:29 -0700 | [diff] [blame] | 1448 | * @return The surface rotation to use. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1449 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1450 | public int rotationForOrientationLw(@ActivityInfo.ScreenOrientation int orientation, |
Andrii Kulian | ef5ce1c | 2018-03-20 19:27:24 -0700 | [diff] [blame] | 1451 | int lastRotation, boolean defaultDisplay); |
Jeff Brown | 01a98dd | 2011-09-20 15:08:29 -0700 | [diff] [blame] | 1452 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1453 | /** |
Jeff Brown | 01a98dd | 2011-09-20 15:08:29 -0700 | [diff] [blame] | 1454 | * Given an orientation constant and a rotation, returns true if the rotation |
| 1455 | * has compatible metrics to the requested orientation. For example, if |
| 1456 | * the application requested landscape and got seascape, then the rotation |
| 1457 | * has compatible metrics; if the application requested portrait and got landscape, |
| 1458 | * then the rotation has incompatible metrics; if the application did not specify |
| 1459 | * a preference, then anything goes. |
| 1460 | * |
| 1461 | * @param orientation An orientation constant, such as |
| 1462 | * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}. |
| 1463 | * @param rotation The rotation to check. |
| 1464 | * @return True if the rotation is compatible with the requested orientation. |
Dianne Hackborn | dacea8c | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 1465 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1466 | public boolean rotationHasCompatibleMetricsLw(@ActivityInfo.ScreenOrientation int orientation, |
| 1467 | int rotation); |
Dianne Hackborn | dacea8c | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 1468 | |
| 1469 | /** |
Jeff Brown | c0347aa | 2011-09-23 17:26:09 -0700 | [diff] [blame] | 1470 | * Called by the window manager when the rotation changes. |
| 1471 | * |
| 1472 | * @param rotation The new rotation. |
| 1473 | */ |
| 1474 | public void setRotationLw(int rotation); |
| 1475 | |
| 1476 | /** |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 1477 | * 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] | 1478 | * the system should go into safe mode. |
| 1479 | */ |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 1480 | public void setSafeMode(boolean safeMode); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1481 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1482 | /** |
| 1483 | * Called when the system is mostly done booting. |
| 1484 | */ |
| 1485 | public void systemReady(); |
| 1486 | |
| 1487 | /** |
Dianne Hackborn | ba24e4d | 2011-09-01 11:17:06 -0700 | [diff] [blame] | 1488 | * Called when the system is done booting to the point where the |
| 1489 | * user can start interacting with it. |
| 1490 | */ |
| 1491 | public void systemBooted(); |
| 1492 | |
| 1493 | /** |
Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 1494 | * Show boot time message to the user. |
| 1495 | */ |
| 1496 | public void showBootMessage(final CharSequence msg, final boolean always); |
| 1497 | |
| 1498 | /** |
| 1499 | * Hide the UI for showing boot messages, never to be displayed again. |
| 1500 | */ |
| 1501 | public void hideBootMessages(); |
| 1502 | |
| 1503 | /** |
Mike Lockwood | ef73162 | 2010-01-27 17:51:34 -0500 | [diff] [blame] | 1504 | * Called when userActivity is signalled in the power manager. |
| 1505 | * This is safe to call from any thread, with any window manager locks held or not. |
| 1506 | */ |
| 1507 | public void userActivity(); |
| 1508 | |
| 1509 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1510 | * Called when we have finished booting and can now display the home |
Jeff Brown | c042ee2 | 2012-05-08 13:03:42 -0700 | [diff] [blame] | 1511 | * 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] | 1512 | * this point the display is active. |
| 1513 | */ |
| 1514 | public void enableScreenAfterBoot(); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1515 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1516 | public void setCurrentOrientationLw(@ActivityInfo.ScreenOrientation int newOrientation); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1517 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1518 | /** |
| 1519 | * Call from application to perform haptic feedback on its window. |
| 1520 | */ |
The Android Open Source Project | c39a6e0 | 2009-03-11 12:11:56 -0700 | [diff] [blame] | 1521 | public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1522 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1523 | /** |
Daniel Sandler | 0601eb7 | 2011-04-13 01:01:32 -0400 | [diff] [blame] | 1524 | * Called when we have started keeping the screen on because a window |
| 1525 | * requesting this has become visible. |
| 1526 | */ |
Jeff Brown | c38c9be | 2012-10-04 13:16:19 -0700 | [diff] [blame] | 1527 | public void keepScreenOnStartedLw(); |
Daniel Sandler | 0601eb7 | 2011-04-13 01:01:32 -0400 | [diff] [blame] | 1528 | |
| 1529 | /** |
| 1530 | * 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] | 1531 | * requesting this is no longer visible. |
| 1532 | */ |
Jeff Brown | c38c9be | 2012-10-04 13:16:19 -0700 | [diff] [blame] | 1533 | public void keepScreenOnStoppedLw(); |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 1534 | |
| 1535 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1536 | * Gets the current user rotation mode. |
Svetoslav Ganov | 80943d8 | 2013-01-02 10:25:37 -0800 | [diff] [blame] | 1537 | * |
| 1538 | * @return The rotation mode. |
| 1539 | * |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 1540 | * @see #USER_ROTATION_LOCKED |
| 1541 | * @see #USER_ROTATION_FREE |
Svetoslav Ganov | 80943d8 | 2013-01-02 10:25:37 -0800 | [diff] [blame] | 1542 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1543 | @UserRotationMode |
Svetoslav Ganov | 80943d8 | 2013-01-02 10:25:37 -0800 | [diff] [blame] | 1544 | public int getUserRotationMode(); |
| 1545 | |
| 1546 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1547 | * Inform the policy that the user has chosen a preferred orientation ("rotation lock"). |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 1548 | * |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 1549 | * @param mode One of {@link #USER_ROTATION_LOCKED} or {@link #USER_ROTATION_FREE}. |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 1550 | * @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90}, |
Craig Mautner | 69b0818 | 2012-09-05 13:07:13 -0700 | [diff] [blame] | 1551 | * {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}. |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 1552 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1553 | public void setUserRotationMode(@UserRotationMode int mode, @Surface.Rotation int rotation); |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 1554 | |
| 1555 | /** |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 1556 | * Called when a new system UI visibility is being reported, allowing |
| 1557 | * the policy to adjust what is actually reported. |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1558 | * @param visibility The raw visibility reported by the status bar. |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 1559 | * @return The new desired visibility. |
| 1560 | */ |
| 1561 | public int adjustSystemUiVisibilityLw(int visibility); |
| 1562 | |
| 1563 | /** |
Winson | ab21660 | 2016-08-09 14:05:20 -0700 | [diff] [blame] | 1564 | * Called by System UI to notify of changes to the visibility of Recents. |
| 1565 | */ |
| 1566 | public void setRecentsVisibilityLw(boolean visible); |
| 1567 | |
| 1568 | /** |
| 1569 | * Called by System UI to notify of changes to the visibility of PIP. |
| 1570 | */ |
Winson Chung | ac52f28 | 2017-03-30 14:44:52 -0700 | [diff] [blame] | 1571 | void setPipVisibilityLw(boolean visible); |
Winson | ab21660 | 2016-08-09 14:05:20 -0700 | [diff] [blame] | 1572 | |
| 1573 | /** |
Matthew Ng | 64543e6 | 2018-02-28 17:35:10 -0800 | [diff] [blame] | 1574 | * Called by System UI to enable or disable haptic feedback on the navigation bar buttons. |
| 1575 | */ |
| 1576 | void setNavBarVirtualKeyHapticFeedbackEnabledLw(boolean enabled); |
| 1577 | |
| 1578 | /** |
Daniel Sandler | 0c4ccff | 2011-10-19 16:39:14 -0400 | [diff] [blame] | 1579 | * Specifies whether there is an on-screen navigation bar separate from the status bar. |
| 1580 | */ |
| 1581 | public boolean hasNavigationBar(); |
| 1582 | |
| 1583 | /** |
Jim Miller | 93c518e | 2012-01-17 15:55:31 -0800 | [diff] [blame] | 1584 | * Lock the device now. |
| 1585 | */ |
Adam Cohen | f752202 | 2012-10-03 20:03:18 -0700 | [diff] [blame] | 1586 | public void lockNow(Bundle options); |
Jim Miller | 93c518e | 2012-01-17 15:55:31 -0800 | [diff] [blame] | 1587 | |
| 1588 | /** |
satok | 1bc0a49 | 2012-04-25 22:47:12 +0900 | [diff] [blame] | 1589 | * Set the last used input method window state. This state is used to make IME transition |
| 1590 | * smooth. |
| 1591 | * @hide |
| 1592 | */ |
| 1593 | public void setLastInputMethodWindowLw(WindowState ime, WindowState target); |
| 1594 | |
| 1595 | /** |
Yohei Yukawa | d6475a6 | 2017-04-17 10:35:27 -0700 | [diff] [blame] | 1596 | * An internal callback (from InputMethodManagerService) to notify a state change regarding |
| 1597 | * whether the back key should dismiss the software keyboard (IME) or not. |
| 1598 | * |
| 1599 | * @param newValue {@code true} if the software keyboard is shown and the back key is expected |
| 1600 | * to dismiss the software keyboard. |
| 1601 | * @hide |
| 1602 | */ |
| 1603 | default void setDismissImeOnBackKeyPressed(boolean newValue) { |
| 1604 | // Default implementation does nothing. |
| 1605 | } |
| 1606 | |
| 1607 | /** |
Craig Mautner | 84984fa | 2014-06-19 11:19:20 -0700 | [diff] [blame] | 1608 | * Show the recents task list app. |
| 1609 | * @hide |
| 1610 | */ |
Winson Chung | dff7a73 | 2017-12-11 12:17:06 -0800 | [diff] [blame] | 1611 | public void showRecentApps(); |
Craig Mautner | 84984fa | 2014-06-19 11:19:20 -0700 | [diff] [blame] | 1612 | |
| 1613 | /** |
Alan Viverette | e34560b2 | 2014-07-10 14:50:06 -0700 | [diff] [blame] | 1614 | * Show the global actions dialog. |
| 1615 | * @hide |
| 1616 | */ |
| 1617 | public void showGlobalActions(); |
| 1618 | |
| 1619 | /** |
Craig Mautner | f1b6741 | 2012-09-19 13:18:29 -0700 | [diff] [blame] | 1620 | * Called when the current user changes. Guaranteed to be called before the broadcast |
| 1621 | * of the new user id is made to all listeners. |
| 1622 | * |
| 1623 | * @param newUserId The id of the incoming user. |
| 1624 | */ |
| 1625 | public void setCurrentUserLw(int newUserId); |
Svetoslav Ganov | 1cf70bb | 2012-08-06 10:53:34 -0700 | [diff] [blame] | 1626 | |
| 1627 | /** |
Evan Rosky | 1839645 | 2016-07-27 15:19:37 -0700 | [diff] [blame] | 1628 | * For a given user-switch operation, this will be called once with switching=true before the |
| 1629 | * user-switch and once with switching=false afterwards (or if the user-switch was cancelled). |
| 1630 | * This gives the policy a chance to alter its behavior for the duration of a user-switch. |
| 1631 | * |
| 1632 | * @param switching true if a user-switch is in progress |
| 1633 | */ |
| 1634 | void setSwitchingUser(boolean switching); |
| 1635 | |
| 1636 | /** |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 1637 | * Print the WindowManagerPolicy's state into the given stream. |
| 1638 | * |
| 1639 | * @param prefix Text to print at the front of each line. |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 1640 | * @param writer The PrintWriter to which you should dump your state. This will be |
| 1641 | * closed for you after you return. |
| 1642 | * @param args additional arguments to the dump request. |
| 1643 | */ |
Jeff Brown | d7a04de | 2012-06-17 14:17:52 -0700 | [diff] [blame] | 1644 | public void dump(String prefix, PrintWriter writer, String[] args); |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 1645 | |
| 1646 | /** |
Steven Timotius | af03df6 | 2017-07-18 16:56:43 -0700 | [diff] [blame] | 1647 | * Write the WindowManagerPolicy's state into the protocol buffer. |
Yi Jin | 6c6e9ca | 2018-03-20 16:53:35 -0700 | [diff] [blame] | 1648 | * The message is described in {@link com.android.server.wm.WindowManagerPolicyProto} |
Steven Timotius | af03df6 | 2017-07-18 16:56:43 -0700 | [diff] [blame] | 1649 | * |
| 1650 | * @param proto The protocol buffer output stream to write to. |
| 1651 | */ |
| 1652 | void writeToProto(ProtoOutputStream proto, long fieldId); |
| 1653 | |
| 1654 | /** |
Svetoslav Ganov | 545252f | 2012-12-10 18:29:24 -0800 | [diff] [blame] | 1655 | * Returns whether a given window type is considered a top level one. |
| 1656 | * A top level window does not have a container, i.e. attached window, |
| 1657 | * or if it has a container it is laid out as a top-level window, not |
| 1658 | * as a child of its container. |
| 1659 | * |
| 1660 | * @param windowType The window type. |
| 1661 | * @return True if the window is a top level one. |
| 1662 | */ |
| 1663 | public boolean isTopLevelWindow(int windowType); |
Jorim Jaggi | 0d67462 | 2014-05-21 01:34:15 +0200 | [diff] [blame] | 1664 | |
| 1665 | /** |
| 1666 | * Notifies the keyguard to start fading out. |
Jorim Jaggi | e29b2db | 2014-05-30 23:17:03 +0200 | [diff] [blame] | 1667 | * |
| 1668 | * @param startTime the start time of the animation in uptime milliseconds |
| 1669 | * @param fadeoutDuration the duration of the exit animation, in milliseconds |
Jorim Jaggi | 0d67462 | 2014-05-21 01:34:15 +0200 | [diff] [blame] | 1670 | */ |
Jorim Jaggi | e29b2db | 2014-05-30 23:17:03 +0200 | [diff] [blame] | 1671 | public void startKeyguardExitAnimation(long startTime, long fadeoutDuration); |
Jorim Jaggi | 737af72 | 2015-12-31 10:42:27 +0100 | [diff] [blame] | 1672 | |
| 1673 | /** |
| 1674 | * Calculates the stable insets without running a layout. |
| 1675 | * |
| 1676 | * @param displayRotation the current display rotation |
Jorim Jaggi | 737af72 | 2015-12-31 10:42:27 +0100 | [diff] [blame] | 1677 | * @param displayWidth the current display width |
| 1678 | * @param displayHeight the current display height |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 1679 | * @param displayCutout the current display cutout |
Winson | 3e87474 | 2016-01-07 10:08:17 -0800 | [diff] [blame] | 1680 | * @param outInsets the insets to return |
Jorim Jaggi | 737af72 | 2015-12-31 10:42:27 +0100 | [diff] [blame] | 1681 | */ |
| 1682 | public void getStableInsetsLw(int displayRotation, int displayWidth, int displayHeight, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 1683 | DisplayCutout displayCutout, Rect outInsets); |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 1684 | |
Jorim Jaggi | 0ffd49c | 2016-02-12 15:04:21 -0800 | [diff] [blame] | 1685 | |
| 1686 | /** |
| 1687 | * @return true if the navigation bar is forced to stay visible |
| 1688 | */ |
| 1689 | public boolean isNavBarForcedShownLw(WindowState win); |
| 1690 | |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 1691 | /** |
Andrii Kulian | 3a1619d | 2017-07-07 14:38:09 -0700 | [diff] [blame] | 1692 | * @return The side of the screen where navigation bar is positioned. |
| 1693 | * @see #NAV_BAR_LEFT |
| 1694 | * @see #NAV_BAR_RIGHT |
| 1695 | * @see #NAV_BAR_BOTTOM |
| 1696 | */ |
Yohei Yukawa | d0a66b2 | 2018-01-10 13:19:54 -0800 | [diff] [blame] | 1697 | @NavigationBarPosition |
Andrii Kulian | 3a1619d | 2017-07-07 14:38:09 -0700 | [diff] [blame] | 1698 | int getNavBarPosition(); |
| 1699 | |
| 1700 | /** |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 1701 | * Calculates the insets for the areas that could never be removed in Honeycomb, i.e. system |
| 1702 | * bar or button bar. See {@link #getNonDecorDisplayWidth}. |
| 1703 | * |
| 1704 | * @param displayRotation the current display rotation |
| 1705 | * @param displayWidth the current display width |
| 1706 | * @param displayHeight the current display height |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 1707 | * @param displayCutout the current display cutout |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 1708 | * @param outInsets the insets to return |
| 1709 | */ |
| 1710 | public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight, |
Adrian Roos | 11c2558 | 2018-02-19 18:06:36 +0100 | [diff] [blame] | 1711 | DisplayCutout displayCutout, Rect outInsets); |
Jorim Jaggi | 5060bd8 | 2016-02-19 17:12:19 -0800 | [diff] [blame] | 1712 | |
| 1713 | /** |
Matthew Ng | 62c7846 | 2018-04-09 14:43:21 -0700 | [diff] [blame] | 1714 | * @param displayRotation the current display rotation |
| 1715 | * @param displayWidth the current display width |
| 1716 | * @param displayHeight the current display height |
| 1717 | * @param dockSide the dockside asking if allowed |
| 1718 | * @param originalDockSide the side that was original docked to in split screen |
Jorim Jaggi | 5060bd8 | 2016-02-19 17:12:19 -0800 | [diff] [blame] | 1719 | * @return True if a specified {@param dockSide} is allowed on the current device, or false |
| 1720 | * otherwise. It is guaranteed that at least one dock side for a particular orientation |
| 1721 | * 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] | 1722 | * If navigation bar is movable then the docked side would bias towards the |
| 1723 | * {@param originalDockSide}. |
Jorim Jaggi | 5060bd8 | 2016-02-19 17:12:19 -0800 | [diff] [blame] | 1724 | */ |
Matthew Ng | 62c7846 | 2018-04-09 14:43:21 -0700 | [diff] [blame] | 1725 | public boolean isDockSideAllowed(int dockSide, int originalDockSide, int displayWidth, |
| 1726 | int displayHeight, int displayRotation); |
Jorim Jaggi | 11c62e1 | 2016-04-05 20:41:21 -0700 | [diff] [blame] | 1727 | |
| 1728 | /** |
| 1729 | * Called when the configuration has changed, and it's safe to load new values from resources. |
| 1730 | */ |
| 1731 | public void onConfigurationChanged(); |
Robert Carr | 6da3cc0 | 2016-06-16 15:17:07 -0700 | [diff] [blame] | 1732 | |
| 1733 | public boolean shouldRotateSeamlessly(int oldRotation, int newRotation); |
Keun-young Park | 4136d2d | 2017-05-08 14:51:59 -0700 | [diff] [blame] | 1734 | |
| 1735 | /** |
| 1736 | * Called when System UI has been started. |
| 1737 | */ |
| 1738 | void onSystemUiStarted(); |
| 1739 | |
| 1740 | /** |
| 1741 | * Checks whether the policy is ready for dismissing the boot animation and completing the boot. |
| 1742 | * |
| 1743 | * @return true if ready; false otherwise. |
| 1744 | */ |
| 1745 | boolean canDismissBootAnimation(); |
Michael Wright | 1985976 | 2017-09-18 20:57:58 +0100 | [diff] [blame] | 1746 | |
| 1747 | /** |
| 1748 | * Convert the user rotation mode to a human readable format. |
| 1749 | */ |
| 1750 | static String userRotationModeToString(int mode) { |
| 1751 | switch(mode) { |
| 1752 | case USER_ROTATION_FREE: |
| 1753 | return "USER_ROTATION_FREE"; |
| 1754 | case USER_ROTATION_LOCKED: |
| 1755 | return "USER_ROTATION_LOCKED"; |
| 1756 | default: |
| 1757 | return Integer.toString(mode); |
| 1758 | } |
| 1759 | } |
Yoshiaki Naka | e1bdfc82 | 2017-09-15 15:24:34 +0900 | [diff] [blame] | 1760 | |
| 1761 | /** |
| 1762 | * Requests that the WindowManager sends WindowManagerPolicy#ACTION_USER_ACTIVITY_NOTIFICATION |
| 1763 | * on the next user activity. |
| 1764 | */ |
| 1765 | public void requestUserActivityNotification(); |
Benjamin Franz | 3662b15 | 2018-01-16 17:23:44 +0000 | [diff] [blame] | 1766 | |
| 1767 | /** |
| 1768 | * Called when the state of lock task mode changes. This should be used to disable immersive |
| 1769 | * mode confirmation. |
| 1770 | * |
| 1771 | * @param lockTaskState the new lock task mode state. One of |
| 1772 | * {@link ActivityManager#LOCK_TASK_MODE_NONE}, |
| 1773 | * {@link ActivityManager#LOCK_TASK_MODE_LOCKED}, |
| 1774 | * {@link ActivityManager#LOCK_TASK_MODE_PINNED}. |
| 1775 | */ |
| 1776 | void onLockTaskStateChangedLw(int lockTaskState); |
chaviw | 0e9fb13 | 2018-06-05 16:29:13 -0700 | [diff] [blame] | 1777 | |
| 1778 | /** |
| 1779 | * Updates the flag about whether AOD is showing. |
| 1780 | * |
| 1781 | * @return whether the value was changed. |
| 1782 | */ |
| 1783 | boolean setAodShowing(boolean aodShowing); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1784 | } |