The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.view; |
| 18 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 19 | import android.annotation.IntDef; |
Bryce Lee | 01b0c5f | 2015-02-05 18:24:04 -0800 | [diff] [blame] | 20 | import android.annotation.SystemApi; |
Jorim Jaggi | 8690558 | 2016-02-09 21:36:09 -0800 | [diff] [blame] | 21 | import android.app.ActivityManager.StackId; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 22 | import android.content.Context; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 23 | import android.content.pm.ActivityInfo; |
Dianne Hackborn | 2f0b175 | 2011-05-31 17:59:49 -0700 | [diff] [blame] | 24 | import android.content.res.CompatibilityInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | import android.content.res.Configuration; |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 26 | import android.graphics.Point; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 27 | import android.graphics.Rect; |
Dianne Hackborn | d040edb | 2011-08-31 12:47:58 -0700 | [diff] [blame] | 28 | import android.graphics.RectF; |
Adam Cohen | f752202 | 2012-10-03 20:03:18 -0700 | [diff] [blame] | 29 | import android.os.Bundle; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 30 | import android.os.IBinder; |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 31 | import android.os.Looper; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | import android.view.animation.Animation; |
| 33 | |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 34 | import java.io.PrintWriter; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 35 | import java.lang.annotation.Retention; |
| 36 | import java.lang.annotation.RetentionPolicy; |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 37 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 38 | /** |
| 39 | * This interface supplies all UI-specific behavior of the window manager. An |
| 40 | * instance of it is created by the window manager when it starts up, and allows |
| 41 | * customization of window layering, special window types, key dispatching, and |
| 42 | * layout. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 43 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | * <p>Because this provides deep interaction with the system window manager, |
| 45 | * specific methods on this interface can be called from a variety of contexts |
| 46 | * with various restrictions on what they can do. These are encoded through |
| 47 | * a suffixes at the end of a method encoding the thread the method is called |
| 48 | * from and any locks that are held when it is being called; if no suffix |
| 49 | * is attached to a method, then it is not called with any locks and may be |
| 50 | * called from the main window manager thread or another thread calling into |
| 51 | * the window manager. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 52 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 | * <p>The current suffixes are: |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 54 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 55 | * <dl> |
| 56 | * <dt> Ti <dd> Called from the input thread. This is the thread that |
| 57 | * collects pending input events and dispatches them to the appropriate window. |
| 58 | * It may block waiting for events to be processed, so that the input stream is |
| 59 | * properly serialized. |
| 60 | * <dt> Tq <dd> Called from the low-level input queue thread. This is the |
| 61 | * thread that reads events out of the raw input devices and places them |
| 62 | * into the global input queue that is read by the <var>Ti</var> thread. |
| 63 | * This thread should not block for a long period of time on anything but the |
| 64 | * key driver. |
| 65 | * <dt> Lw <dd> Called with the main window manager lock held. Because the |
| 66 | * window manager is a very low-level system service, there are few other |
| 67 | * system services you can call with this lock held. It is explicitly okay to |
| 68 | * 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] | 69 | * 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] | 70 | * {@link android.content.Context#checkPermission(String, int, int)} and |
| 71 | * variations require calling into the activity manager. |
| 72 | * <dt> Li <dd> Called with the input thread lock held. This lock can be |
| 73 | * acquired by the window manager while it holds the window lock, so this is |
| 74 | * even more restrictive than <var>Lw</var>. |
| 75 | * </dl> |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 76 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 77 | * @hide |
| 78 | */ |
| 79 | public interface WindowManagerPolicy { |
Jeff Brown | b699726 | 2010-10-08 22:31:17 -0700 | [diff] [blame] | 80 | // Policy flags. These flags are also defined in frameworks/base/include/ui/Input.h. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | public final static int FLAG_WAKE = 0x00000001; |
Michael Wright | 337d9d2 | 2014-04-22 15:03:48 -0700 | [diff] [blame] | 82 | public final static int FLAG_VIRTUAL = 0x00000002; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 83 | |
Jeff Brown | 85a3176 | 2010-09-01 17:01:00 -0700 | [diff] [blame] | 84 | public final static int FLAG_INJECTED = 0x01000000; |
Jeff Brown | e20c9e0 | 2010-10-11 14:20:19 -0700 | [diff] [blame] | 85 | public final static int FLAG_TRUSTED = 0x02000000; |
Jeff Brown | 0029c66 | 2011-03-30 02:25:18 -0700 | [diff] [blame] | 86 | public final static int FLAG_FILTERED = 0x04000000; |
| 87 | public final static int FLAG_DISABLE_KEY_REPEAT = 0x08000000; |
Jeff Brown | 85a3176 | 2010-09-01 17:01:00 -0700 | [diff] [blame] | 88 | |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 89 | public final static int FLAG_INTERACTIVE = 0x20000000; |
Jeff Brown | b699726 | 2010-10-08 22:31:17 -0700 | [diff] [blame] | 90 | public final static int FLAG_PASS_TO_USER = 0x40000000; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 91 | |
Jeff Brown | daa3753 | 2012-05-01 15:54:03 -0700 | [diff] [blame] | 92 | // Flags used for indicating whether the internal and/or external input devices |
| 93 | // of some type are available. |
| 94 | public final static int PRESENCE_INTERNAL = 1 << 0; |
| 95 | public final static int PRESENCE_EXTERNAL = 1 << 1; |
| 96 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 97 | public final static boolean WATCH_POINTER = false; |
| 98 | |
Dianne Hackborn | ad7fa7f | 2011-01-07 14:06:50 -0800 | [diff] [blame] | 99 | /** |
| 100 | * Sticky broadcast of the current HDMI plugged state. |
| 101 | */ |
| 102 | public final static String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED"; |
| 103 | |
| 104 | /** |
| 105 | * Extra in {@link #ACTION_HDMI_PLUGGED} indicating the state: true if |
| 106 | * plugged in to HDMI, false if not. |
| 107 | */ |
| 108 | public final static String EXTRA_HDMI_PLUGGED_STATE = "state"; |
| 109 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 110 | /** |
Bryce Lee | 01b0c5f | 2015-02-05 18:24:04 -0800 | [diff] [blame] | 111 | * Set to {@code true} when intent was invoked from pressing the home key. |
| 112 | * @hide |
| 113 | */ |
| 114 | @SystemApi |
| 115 | public static final String EXTRA_FROM_HOME_KEY = "android.intent.extra.FROM_HOME_KEY"; |
| 116 | |
| 117 | /** |
Jeff Brown | d5bb82d | 2011-10-12 13:57:59 -0700 | [diff] [blame] | 118 | * Pass this event to the user / app. To be returned from |
| 119 | * {@link #interceptKeyBeforeQueueing}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 120 | */ |
| 121 | public final static int ACTION_PASS_TO_USER = 0x00000001; |
| 122 | |
| 123 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 124 | * Interface to the Window Manager state associated with a particular |
| 125 | * window. You can hold on to an instance of this interface from the call |
| 126 | * to prepareAddWindow() until removeWindow(). |
| 127 | */ |
| 128 | public interface WindowState { |
| 129 | /** |
Dianne Hackborn | f265ea9 | 2013-01-31 15:00:51 -0800 | [diff] [blame] | 130 | * Return the uid of the app that owns this window. |
| 131 | */ |
| 132 | int getOwningUid(); |
| 133 | |
| 134 | /** |
| 135 | * Return the package name of the app that owns this window. |
| 136 | */ |
| 137 | String getOwningPackage(); |
| 138 | |
| 139 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 140 | * Perform standard frame computation. The result can be obtained with |
| 141 | * getFrame() if so desired. Must be called with the window manager |
| 142 | * lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 143 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 144 | * @param parentFrame The frame of the parent container this window |
| 145 | * is in, used for computing its basic position. |
| 146 | * @param displayFrame The frame of the overall display in which this |
| 147 | * window can appear, used for constraining the overall dimensions |
| 148 | * of the window. |
Dianne Hackborn | c4aad01 | 2013-02-22 15:05:25 -0800 | [diff] [blame] | 149 | * @param overlayFrame The frame within the display that is inside |
| 150 | * of the overlay region. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 151 | * @param contentFrame The frame within the display in which we would |
| 152 | * like active content to appear. This will cause windows behind to |
| 153 | * be resized to match the given content frame. |
| 154 | * @param visibleFrame The frame within the display that the window |
| 155 | * is actually visible, used for computing its visible insets to be |
| 156 | * given to windows behind. |
| 157 | * This can be used as a hint for scrolling (avoiding resizing) |
| 158 | * the window to make certain that parts of its content |
| 159 | * are visible. |
John Spurlock | 4664623 | 2013-09-30 22:32:42 -0400 | [diff] [blame] | 160 | * @param decorFrame The decor frame specified by policy specific to this window, |
| 161 | * to use for proper cropping during animation. |
Adrian Roos | fa10423 | 2014-06-20 16:10:14 -0700 | [diff] [blame] | 162 | * @param stableFrame The frame around which stable system decoration is positioned. |
Filip Gruszczynski | 2217f61 | 2015-05-26 11:32:08 -0700 | [diff] [blame] | 163 | * @param outsetFrame The frame that includes areas that aren't part of the surface but we |
| 164 | * want to treat them as such. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 165 | */ |
| 166 | public void computeFrameLw(Rect parentFrame, Rect displayFrame, |
Adrian Roos | fa10423 | 2014-06-20 16:10:14 -0700 | [diff] [blame] | 167 | Rect overlayFrame, Rect contentFrame, Rect visibleFrame, Rect decorFrame, |
Filip Gruszczynski | 2217f61 | 2015-05-26 11:32:08 -0700 | [diff] [blame] | 168 | Rect stableFrame, Rect outsetFrame); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 169 | |
| 170 | /** |
| 171 | * Retrieve the current frame of the window that has been assigned by |
| 172 | * the window manager. Must be called with the window manager lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 173 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 174 | * @return Rect The rectangle holding the window frame. |
| 175 | */ |
| 176 | public Rect getFrameLw(); |
| 177 | |
| 178 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 179 | * Retrieve the current position of the window that is actually shown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 180 | * Must be called with the window manager lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 181 | * |
| 182 | * @return Point The point holding the shown window position. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 183 | */ |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 184 | public Point getShownPositionLw(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 185 | |
| 186 | /** |
| 187 | * Retrieve the frame of the display that this window was last |
| 188 | * laid out in. Must be called with the |
| 189 | * window manager lock held. |
Dianne Hackborn | 5c58de3 | 2012-04-28 19:52:37 -0700 | [diff] [blame] | 190 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 191 | * @return Rect The rectangle holding the display frame. |
| 192 | */ |
| 193 | public Rect getDisplayFrameLw(); |
| 194 | |
| 195 | /** |
Dianne Hackborn | c4aad01 | 2013-02-22 15:05:25 -0800 | [diff] [blame] | 196 | * Retrieve the frame of the area inside the overscan region of the |
| 197 | * display that this window was last laid out in. Must be called with the |
| 198 | * window manager lock held. |
| 199 | * |
| 200 | * @return Rect The rectangle holding the display overscan frame. |
| 201 | */ |
| 202 | public Rect getOverscanFrameLw(); |
| 203 | |
| 204 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 205 | * Retrieve the frame of the content area that this window was last |
| 206 | * laid out in. This is the area in which the content of the window |
| 207 | * should be placed. It will be smaller than the display frame to |
| 208 | * account for screen decorations such as a status bar or soft |
| 209 | * keyboard. Must be called with the |
| 210 | * window manager lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 211 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 212 | * @return Rect The rectangle holding the content frame. |
| 213 | */ |
| 214 | public Rect getContentFrameLw(); |
| 215 | |
| 216 | /** |
| 217 | * Retrieve the frame of the visible area that this window was last |
| 218 | * laid out in. This is the area of the screen in which the window |
| 219 | * will actually be fully visible. It will be smaller than the |
| 220 | * content frame to account for transient UI elements blocking it |
| 221 | * such as an input method's candidates UI. Must be called with the |
| 222 | * window manager lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 223 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 224 | * @return Rect The rectangle holding the visible frame. |
| 225 | */ |
| 226 | public Rect getVisibleFrameLw(); |
| 227 | |
| 228 | /** |
| 229 | * Returns true if this window is waiting to receive its given |
| 230 | * internal insets from the client app, and so should not impact the |
| 231 | * layout of other windows. |
| 232 | */ |
| 233 | public boolean getGivenInsetsPendingLw(); |
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 | /** |
| 236 | * Retrieve the insets given by this window's client for the content |
| 237 | * area of windows behind it. Must be called with the |
| 238 | * window manager lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 239 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 240 | * @return Rect The left, top, right, and bottom insets, relative |
| 241 | * to the window's frame, of the actual contents. |
| 242 | */ |
| 243 | public Rect getGivenContentInsetsLw(); |
| 244 | |
| 245 | /** |
| 246 | * Retrieve the insets given by this window's client for the visible |
| 247 | * area of windows behind it. Must be called with the |
| 248 | * window manager lock held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 249 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 250 | * @return Rect The left, top, right, and bottom insets, relative |
| 251 | * to the window's frame, of the actual visible area. |
| 252 | */ |
| 253 | public Rect getGivenVisibleInsetsLw(); |
| 254 | |
| 255 | /** |
| 256 | * Retrieve the current LayoutParams of the window. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 257 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 258 | * @return WindowManager.LayoutParams The window's internal LayoutParams |
| 259 | * instance. |
| 260 | */ |
| 261 | public WindowManager.LayoutParams getAttrs(); |
| 262 | |
| 263 | /** |
Dianne Hackborn | 73ab6a4 | 2011-12-13 11:16:23 -0800 | [diff] [blame] | 264 | * Return whether this window needs the menu key shown. Must be called |
| 265 | * with window lock held, because it may need to traverse down through |
| 266 | * window list to determine the result. |
| 267 | * @param bottom The bottom-most window to consider when determining this. |
| 268 | */ |
| 269 | public boolean getNeedsMenuLw(WindowState bottom); |
| 270 | |
| 271 | /** |
Dianne Hackborn | 9a230e0 | 2011-10-06 11:51:27 -0700 | [diff] [blame] | 272 | * Retrieve the current system UI visibility flags associated with |
| 273 | * this window. |
| 274 | */ |
| 275 | public int getSystemUiVisibility(); |
| 276 | |
| 277 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 278 | * Get the layer at which this window's surface will be Z-ordered. |
| 279 | */ |
| 280 | public int getSurfaceLayer(); |
Selim Cinek | d662361 | 2015-05-22 18:56:22 -0700 | [diff] [blame] | 281 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 282 | /** |
Selim Cinek | d662361 | 2015-05-22 18:56:22 -0700 | [diff] [blame] | 283 | * Retrieve the type of the top-level window. |
| 284 | * |
| 285 | * @return the base type of the parent window if attached or its own type otherwise |
| 286 | */ |
| 287 | public int getBaseType(); |
| 288 | |
| 289 | /** |
| 290 | * Return the token for the application (actually activity) that owns |
| 291 | * this window. May return null for system windows. |
| 292 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 293 | * @return An IApplicationToken identifying the owning activity. |
| 294 | */ |
| 295 | public IApplicationToken getAppToken(); |
| 296 | |
| 297 | /** |
Dianne Hackborn | e30e02f | 2014-05-27 18:24:45 -0700 | [diff] [blame] | 298 | * Return true if this window is participating in voice interaction. |
| 299 | */ |
| 300 | public boolean isVoiceInteraction(); |
| 301 | |
| 302 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 303 | * Return true if, at any point, the application token associated with |
| 304 | * this window has actually displayed any windows. This is most useful |
| 305 | * with the "starting up" window to determine if any windows were |
| 306 | * displayed when it is closed. |
| 307 | * |
| 308 | * @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] | 309 | * else false. |
| 310 | */ |
| 311 | public boolean hasAppShownWindows(); |
| 312 | |
| 313 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 314 | * Is this window visible? It is not visible if there is no |
| 315 | * surface, or we are in the process of running an exit animation |
| 316 | * that will remove the surface. |
| 317 | */ |
| 318 | boolean isVisibleLw(); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 319 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 320 | /** |
Dianne Hackborn | 3d163f07 | 2009-10-07 21:26:57 -0700 | [diff] [blame] | 321 | * Like {@link #isVisibleLw}, but also counts a window that is currently |
| 322 | * "hidden" behind the keyguard as visible. This allows us to apply |
| 323 | * things like window flags that impact the keyguard. |
| 324 | */ |
| 325 | boolean isVisibleOrBehindKeyguardLw(); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 326 | |
Dianne Hackborn | 3d163f07 | 2009-10-07 21:26:57 -0700 | [diff] [blame] | 327 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 328 | * Is this window currently visible to the user on-screen? It is |
| 329 | * 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] | 330 | * animation before no longer being visible. Must be called with the |
| 331 | * window manager lock held. |
| 332 | */ |
| 333 | boolean isDisplayedLw(); |
| 334 | |
| 335 | /** |
Dianne Hackborn | 5c58de3 | 2012-04-28 19:52:37 -0700 | [diff] [blame] | 336 | * Return true if this window (or a window it is attached to, but not |
| 337 | * considering its app token) is currently animating. |
| 338 | */ |
Filip Gruszczynski | 14b4e57 | 2015-11-03 15:53:55 -0800 | [diff] [blame] | 339 | boolean isAnimatingLw(); |
Dianne Hackborn | 5c58de3 | 2012-04-28 19:52:37 -0700 | [diff] [blame] | 340 | |
| 341 | /** |
Dianne Hackborn | 01b02a7 | 2012-01-12 14:05:03 -0800 | [diff] [blame] | 342 | * Is this window considered to be gone for purposes of layout? |
| 343 | */ |
| 344 | boolean isGoneForLayoutLw(); |
| 345 | |
| 346 | /** |
Adrian Roos | 76d2fe4 | 2015-07-09 14:54:08 -0700 | [diff] [blame] | 347 | * Returns true if the window has a surface that it has drawn a |
| 348 | * complete UI in to. Note that this is different from {@link #hasDrawnLw()} |
| 349 | * in that it also returns true if the window is READY_TO_SHOW, but was not yet |
| 350 | * promoted to HAS_DRAWN. |
| 351 | */ |
| 352 | boolean isDrawnLw(); |
| 353 | |
| 354 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 355 | * 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] | 356 | * the past. Must be called with the window manager lock held. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 357 | */ |
| 358 | public boolean hasDrawnLw(); |
| 359 | |
| 360 | /** |
| 361 | * Can be called by the policy to force a window to be hidden, |
| 362 | * regardless of whether the client or window manager would like |
| 363 | * it shown. Must be called with the window manager lock held. |
| 364 | * Returns true if {@link #showLw} was last called for the window. |
| 365 | */ |
| 366 | public boolean hideLw(boolean doAnimation); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 367 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 368 | /** |
| 369 | * Can be called to undo the effect of {@link #hideLw}, allowing a |
| 370 | * window to be shown as long as the window manager and client would |
| 371 | * also like it to be shown. Must be called with the window manager |
| 372 | * lock held. |
| 373 | * Returns true if {@link #hideLw} was last called for the window. |
| 374 | */ |
| 375 | public boolean showLw(boolean doAnimation); |
Dianne Hackborn | f87d196 | 2012-04-04 12:48:24 -0700 | [diff] [blame] | 376 | |
| 377 | /** |
| 378 | * Check whether the process hosting this window is currently alive. |
| 379 | */ |
| 380 | public boolean isAlive(); |
Craig Mautner | 69b0818 | 2012-09-05 13:07:13 -0700 | [diff] [blame] | 381 | |
| 382 | /** |
| 383 | * Check if window is on {@link Display#DEFAULT_DISPLAY}. |
| 384 | * @return true if window is on default display. |
| 385 | */ |
| 386 | public boolean isDefaultDisplay(); |
Adrian Roos | cd3884d | 2015-02-18 17:25:23 +0100 | [diff] [blame] | 387 | |
| 388 | /** |
| 389 | * Check whether the window is currently dimming. |
| 390 | */ |
| 391 | public boolean isDimming(); |
Jorim Jaggi | 8690558 | 2016-02-09 21:36:09 -0800 | [diff] [blame] | 392 | |
| 393 | /** |
| 394 | * @return the stack id this windows belongs to, or {@link StackId#INVALID_STACK_ID} if |
| 395 | * not attached to any stack. |
| 396 | */ |
| 397 | int getStackId(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 398 | } |
| 399 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 400 | /** |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 401 | * Representation of a input consumer that the policy has added to the |
| 402 | * window manager to consume input events going to windows below it. |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 403 | */ |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 404 | public interface InputConsumer { |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 405 | /** |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 406 | * Remove the input consumer from the window manager. |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 407 | */ |
| 408 | void dismiss(); |
| 409 | } |
| 410 | |
| 411 | /** |
| 412 | * Interface for calling back in to the window manager that is private |
| 413 | * between it and the policy. |
| 414 | */ |
| 415 | public interface WindowManagerFuncs { |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 416 | public static final int LID_ABSENT = -1; |
| 417 | public static final int LID_CLOSED = 0; |
| 418 | public static final int LID_OPEN = 1; |
| 419 | |
Michael Wright | 3818c92 | 2014-09-02 13:59:07 -0700 | [diff] [blame] | 420 | public static final int CAMERA_LENS_COVER_ABSENT = -1; |
| 421 | public static final int CAMERA_LENS_UNCOVERED = 0; |
| 422 | public static final int CAMERA_LENS_COVERED = 1; |
| 423 | |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 424 | /** |
| 425 | * Ask the window manager to re-evaluate the system UI flags. |
| 426 | */ |
| 427 | public void reevaluateStatusBarVisibility(); |
| 428 | |
| 429 | /** |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 430 | * 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] | 431 | */ |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 432 | public InputConsumer addInputConsumer(Looper looper, |
| 433 | InputEventReceiver.Factory inputEventReceiverFactory); |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 434 | |
| 435 | /** |
| 436 | * Returns a code that describes the current state of the lid switch. |
| 437 | */ |
| 438 | public int getLidState(); |
| 439 | |
| 440 | /** |
Edward Savage-Jones | 7def60d | 2015-11-13 13:27:03 +0100 | [diff] [blame] | 441 | * Lock the device now. |
| 442 | */ |
| 443 | public void lockDeviceNow(); |
| 444 | |
| 445 | /** |
Michael Wright | 3818c92 | 2014-09-02 13:59:07 -0700 | [diff] [blame] | 446 | * Returns a code that descripbes whether the camera lens is covered or not. |
| 447 | */ |
| 448 | public int getCameraLensCoverState(); |
| 449 | |
| 450 | /** |
Yohei Yukawa | ae61f71 | 2015-12-09 13:00:10 -0800 | [diff] [blame] | 451 | * Switch the input method, to be precise, input method subtype. |
| 452 | * |
| 453 | * @param forwardDirection {@code true} to rotate in a forward direction. |
| 454 | */ |
| 455 | public void switchInputMethod(boolean forwardDirection); |
| 456 | |
Jeff Brown | 9a538ee | 2012-08-20 14:56:57 -0700 | [diff] [blame] | 457 | public void shutdown(boolean confirm); |
| 458 | public void rebootSafeMode(boolean confirm); |
John Spurlock | 04db176 | 2013-05-13 12:46:41 -0400 | [diff] [blame] | 459 | |
| 460 | /** |
| 461 | * Return the window manager lock needed to correctly call "Lw" methods. |
| 462 | */ |
| 463 | public Object getWindowManagerLock(); |
Craig Mautner | 037aa8d | 2013-06-07 10:35:44 -0700 | [diff] [blame] | 464 | |
| 465 | /** Register a system listener for touch events */ |
| 466 | void registerPointerEventListener(PointerEventListener listener); |
| 467 | |
| 468 | /** Unregister a system listener for touch events */ |
| 469 | void unregisterPointerEventListener(PointerEventListener listener); |
Jorim Jaggi | 81ba11e | 2016-02-03 22:04:22 -0800 | [diff] [blame] | 470 | |
| 471 | /** |
| 472 | * @return The content insets of the docked divider window. |
| 473 | */ |
| 474 | int getDockedDividerInsetsLw(); |
Jorim Jaggi | 8690558 | 2016-02-09 21:36:09 -0800 | [diff] [blame] | 475 | |
| 476 | /** |
| 477 | * Retrieves the {@param outBounds} from the stack with id {@param stackId}. |
| 478 | */ |
| 479 | void getStackBounds(int stackId, Rect outBounds); |
Craig Mautner | 037aa8d | 2013-06-07 10:35:44 -0700 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | public interface PointerEventListener { |
| 483 | /** |
| 484 | * 1. onPointerEvent will be called on the service.UiThread. |
| 485 | * 2. motionEvent will be recycled after onPointerEvent returns so if it is needed later a |
| 486 | * copy() must be made and the copy must be recycled. |
| 487 | **/ |
| 488 | public void onPointerEvent(MotionEvent motionEvent); |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 489 | } |
| 490 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 491 | /** Window has been added to the screen. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 492 | public static final int TRANSIT_ENTER = 1; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 493 | /** Window has been removed from the screen. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 494 | public static final int TRANSIT_EXIT = 2; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 495 | /** Window has been made visible. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 496 | public static final int TRANSIT_SHOW = 3; |
| 497 | /** Window has been made invisible. |
| 498 | * TODO: Consider removal as this is unused. */ |
| 499 | public static final int TRANSIT_HIDE = 4; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 500 | /** The "application starting" preview window is no longer needed, and will |
| 501 | * animate away to show the real window. */ |
Craig Mautner | 4b71aa1 | 2012-12-27 17:20:01 -0800 | [diff] [blame] | 502 | public static final int TRANSIT_PREVIEW_DONE = 5; |
| 503 | |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 504 | // NOTE: screen off reasons are in order of significance, with more |
| 505 | // important ones lower than less important ones. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 506 | |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 507 | /** Screen turned off because of a device admin */ |
| 508 | public final int OFF_BECAUSE_OF_ADMIN = 1; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 509 | /** Screen turned off because of power button */ |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 510 | public final int OFF_BECAUSE_OF_USER = 2; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 511 | /** Screen turned off because of timeout */ |
Dianne Hackborn | 254cb44 | 2010-01-27 19:23:59 -0800 | [diff] [blame] | 512 | public final int OFF_BECAUSE_OF_TIMEOUT = 3; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 513 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 514 | /** @hide */ |
| 515 | @IntDef({USER_ROTATION_FREE, USER_ROTATION_LOCKED}) |
| 516 | @Retention(RetentionPolicy.SOURCE) |
| 517 | public @interface UserRotationMode {} |
| 518 | |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 519 | /** When not otherwise specified by the activity's screenOrientation, rotation should be |
| 520 | * determined by the system (that is, using sensors). */ |
| 521 | public final int USER_ROTATION_FREE = 0; |
| 522 | /** When not otherwise specified by the activity's screenOrientation, rotation is set by |
| 523 | * the user. */ |
| 524 | public final int USER_ROTATION_LOCKED = 1; |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 525 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 526 | /** |
| 527 | * Perform initialization of the policy. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 528 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 529 | * @param context The system context we are running in. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 530 | */ |
| 531 | public void init(Context context, IWindowManager windowManager, |
Jeff Brown | 9630704 | 2012-07-27 15:51:34 -0700 | [diff] [blame] | 532 | WindowManagerFuncs windowManagerFuncs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 533 | |
| 534 | /** |
Craig Mautner | 46ac6fa | 2013-08-01 10:06:34 -0700 | [diff] [blame] | 535 | * @return true if com.android.internal.R.bool#config_forceDefaultOrientation is true. |
| 536 | */ |
| 537 | public boolean isDefaultOrientationForced(); |
| 538 | |
| 539 | /** |
Dianne Hackborn | 9d13264 | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 540 | * Called by window manager once it has the initial, default native |
| 541 | * display dimensions. |
| 542 | */ |
Dianne Hackborn | dde331c | 2012-08-03 14:01:57 -0700 | [diff] [blame] | 543 | public void setInitialDisplaySize(Display display, int width, int height, int density); |
Dianne Hackborn | dacea8c | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 544 | |
Dianne Hackborn | 9d13264 | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 545 | /** |
Dianne Hackborn | c652de8 | 2013-02-15 16:32:56 -0800 | [diff] [blame] | 546 | * Called by window manager to set the overscan region that should be used for the |
| 547 | * given display. |
| 548 | */ |
| 549 | public void setDisplayOverscan(Display display, int left, int top, int right, int bottom); |
| 550 | |
| 551 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 552 | * Check permissions when adding a window. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 553 | * |
Dianne Hackborn | c229302 | 2013-02-06 23:14:49 -0800 | [diff] [blame] | 554 | * @param attrs The window's LayoutParams. |
| 555 | * @param outAppOp First element will be filled with the app op corresponding to |
| 556 | * this window, or OP_NONE. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 557 | * |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 558 | * @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] | 559 | * else an error code, usually |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 560 | * {@link WindowManagerGlobal#ADD_PERMISSION_DENIED}, to abort the add. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 561 | */ |
Dianne Hackborn | c229302 | 2013-02-06 23:14:49 -0800 | [diff] [blame] | 562 | public int checkAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 563 | |
| 564 | /** |
Craig Mautner | 88400d3 | 2012-09-30 12:35:45 -0700 | [diff] [blame] | 565 | * Check permissions when adding a window. |
| 566 | * |
| 567 | * @param attrs The window's LayoutParams. |
| 568 | * |
| 569 | * @return True if the window may only be shown to the current user, false if the window can |
| 570 | * be shown on all users' windows. |
| 571 | */ |
| 572 | public boolean checkShowToOwnerOnly(WindowManager.LayoutParams attrs); |
| 573 | |
| 574 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 575 | * Sanitize the layout parameters coming from a client. Allows the policy |
| 576 | * to do things like ensure that windows of a specific type can't take |
| 577 | * input focus. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 578 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 579 | * @param attrs The window layout parameters to be modified. These values |
| 580 | * are modified in-place. |
| 581 | */ |
| 582 | public void adjustWindowParamsLw(WindowManager.LayoutParams attrs); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 583 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 584 | /** |
| 585 | * After the window manager has computed the current configuration based |
| 586 | * on its knowledge of the display and input devices, it gives the policy |
| 587 | * a chance to adjust the information contained in it. If you want to |
| 588 | * leave it as-is, simply do nothing. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 589 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 590 | * <p>This method may be called by any thread in the window manager, but |
| 591 | * no internal locks in the window manager will be held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 592 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 593 | * @param config The Configuration being computed, for you to change as |
| 594 | * desired. |
Jeff Brown | daa3753 | 2012-05-01 15:54:03 -0700 | [diff] [blame] | 595 | * @param keyboardPresence Flags that indicate whether internal or external |
| 596 | * keyboards are present. |
| 597 | * @param navigationPresence Flags that indicate whether internal or external |
| 598 | * navigation devices are present. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 599 | */ |
Jeff Brown | daa3753 | 2012-05-01 15:54:03 -0700 | [diff] [blame] | 600 | public void adjustConfigurationLw(Configuration config, int keyboardPresence, |
| 601 | int navigationPresence); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 602 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 603 | /** |
| 604 | * Assign a window type to a layer. Allows you to control how different |
| 605 | * kinds of windows are ordered on-screen. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 606 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 607 | * @param type The type of window being assigned. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 608 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 609 | * @return int An arbitrary integer used to order windows, with lower |
| 610 | * numbers below higher ones. |
| 611 | */ |
| 612 | public int windowTypeToLayerLw(int type); |
| 613 | |
| 614 | /** |
| 615 | * Return how to Z-order sub-windows in relation to the window they are |
| 616 | * attached to. Return positive to have them ordered in front, negative for |
| 617 | * behind. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 618 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 619 | * @param type The sub-window type code. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 620 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 621 | * @return int Layer in relation to the attached window, where positive is |
| 622 | * above and negative is below. |
| 623 | */ |
| 624 | public int subWindowTypeToLayerLw(int type); |
| 625 | |
| 626 | /** |
Dianne Hackborn | 6136b7e | 2009-09-18 01:53:49 -0700 | [diff] [blame] | 627 | * Get the highest layer (actually one more than) that the wallpaper is |
| 628 | * allowed to be in. |
| 629 | */ |
| 630 | public int getMaxWallpaperLayer(); |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 631 | |
| 632 | /** |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 633 | * Return the display width available after excluding any screen |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 634 | * 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] | 635 | * button bar. |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 636 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 637 | public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation, |
| 638 | int uiMode); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 639 | |
| 640 | /** |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 641 | * Return the display height available after excluding any screen |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 642 | * 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] | 643 | * button bar. |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 644 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 645 | public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation, |
| 646 | int uiMode); |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 647 | |
| 648 | /** |
| 649 | * Return the available screen width that we should report for the |
| 650 | * configuration. This must be no larger than |
Craig Mautner | 61ac6bb | 2012-02-02 17:29:33 -0800 | [diff] [blame] | 651 | * {@link #getNonDecorDisplayWidth(int, int, int)}; it may be smaller than |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 652 | * that to account for more transient decoration like a status bar. |
| 653 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 654 | public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation, |
| 655 | int uiMode); |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 656 | |
| 657 | /** |
| 658 | * Return the available screen height that we should report for the |
| 659 | * configuration. This must be no larger than |
Craig Mautner | 61ac6bb | 2012-02-02 17:29:33 -0800 | [diff] [blame] | 660 | * {@link #getNonDecorDisplayHeight(int, int, int)}; it may be smaller than |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 661 | * that to account for more transient decoration like a status bar. |
| 662 | */ |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 663 | public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation, |
| 664 | int uiMode); |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 665 | |
| 666 | /** |
Craig Mautner | c9457fa | 2014-06-06 14:27:48 -0700 | [diff] [blame] | 667 | * Return whether the given window is forcibly hiding all windows except windows with |
| 668 | * FLAG_SHOW_WHEN_LOCKED set. Typically returns true for the keyguard. |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 669 | */ |
Craig Mautner | c9457fa | 2014-06-06 14:27:48 -0700 | [diff] [blame] | 670 | public boolean isForceHiding(WindowManager.LayoutParams attrs); |
Jorim Jaggi | 0d67462 | 2014-05-21 01:34:15 +0200 | [diff] [blame] | 671 | |
| 672 | |
| 673 | /** |
Craig Mautner | c9457fa | 2014-06-06 14:27:48 -0700 | [diff] [blame] | 674 | * Return whether the given window can become one that passes isForceHiding() test. |
Jorim Jaggi | 0d67462 | 2014-05-21 01:34:15 +0200 | [diff] [blame] | 675 | * Typically returns true for the StatusBar. |
| 676 | */ |
| 677 | public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs); |
| 678 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 679 | /** |
| 680 | * Determine if a window that is behind one that is force hiding |
Craig Mautner | c9457fa | 2014-06-06 14:27:48 -0700 | [diff] [blame] | 681 | * (as determined by {@link #isForceHiding}) should actually be hidden. |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 682 | * For example, typically returns false for the status bar. Be careful |
| 683 | * to return false for any window that you may hide yourself, since this |
| 684 | * will conflict with what you set. |
| 685 | */ |
| 686 | public boolean canBeForceHidden(WindowState win, WindowManager.LayoutParams attrs); |
Jorim Jaggi | 0d67462 | 2014-05-21 01:34:15 +0200 | [diff] [blame] | 687 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 688 | /** |
Craig Mautner | 7d7808f | 2014-09-11 18:02:38 -0700 | [diff] [blame] | 689 | * Return the window that is hiding the keyguard, if such a thing exists. |
| 690 | */ |
| 691 | public WindowState getWinShowWhenLockedLw(); |
| 692 | |
| 693 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 694 | * Called when the system would like to show a UI to indicate that an |
| 695 | * application is starting. You can use this to add a |
| 696 | * APPLICATION_STARTING_TYPE window with the given appToken to the window |
| 697 | * manager (using the normal window manager APIs) that will be shown until |
| 698 | * the application displays its own window. This is called without the |
| 699 | * window manager locked so that you can call back into it. |
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 appToken Token of the application being started. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 702 | * @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] | 703 | * @param theme Resource defining the application's overall visual theme. |
| 704 | * @param nonLocalizedLabel The default title label of the application if |
| 705 | * no data is found in the resource. |
| 706 | * @param labelRes The resource ID the application would like to use as its name. |
| 707 | * @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] | 708 | * @param windowFlags Window layout flags. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 709 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 710 | * @return Optionally you can return the View that was used to create the |
| 711 | * window, for easy removal in removeStartingWindow. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 712 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 713 | * @see #removeStartingWindow |
| 714 | */ |
| 715 | public View addStartingWindow(IBinder appToken, String packageName, |
Dianne Hackborn | 2f0b175 | 2011-05-31 17:59:49 -0700 | [diff] [blame] | 716 | int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, |
Adam Powell | 04fe6eb | 2013-05-31 14:39:48 -0700 | [diff] [blame] | 717 | int labelRes, int icon, int logo, int windowFlags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 718 | |
| 719 | /** |
| 720 | * Called when the first window of an application has been displayed, while |
| 721 | * {@link #addStartingWindow} has created a temporary initial window for |
| 722 | * that application. You should at this point remove the window from the |
| 723 | * window manager. This is called without the window manager locked so |
| 724 | * that you can call back into it. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 725 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 726 | * <p>Note: due to the nature of these functions not being called with the |
| 727 | * window manager locked, you must be prepared for this function to be |
| 728 | * called multiple times and/or an initial time with a null View window |
| 729 | * even if you previously returned one. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 730 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 731 | * @param appToken Token of the application that has started. |
| 732 | * @param window Window View that was returned by createStartingWindow. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 733 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 734 | * @see #addStartingWindow |
| 735 | */ |
| 736 | public void removeStartingWindow(IBinder appToken, View window); |
| 737 | |
| 738 | /** |
| 739 | * Prepare for a window being added to the window manager. You can throw an |
| 740 | * exception here to prevent the window being added, or do whatever setup |
| 741 | * you need to keep track of the window. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 742 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 743 | * @param win The window being added. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 744 | * @param attrs The window's LayoutParams. |
| 745 | * |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 746 | * @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] | 747 | * error code to abort the add. |
| 748 | */ |
| 749 | public int prepareAddWindowLw(WindowState win, |
| 750 | WindowManager.LayoutParams attrs); |
| 751 | |
| 752 | /** |
| 753 | * Called when a window is being removed from a window manager. Must not |
| 754 | * throw an exception -- clean up as much as possible. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 755 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 756 | * @param win The window being removed. |
| 757 | */ |
| 758 | public void removeWindowLw(WindowState win); |
| 759 | |
| 760 | /** |
| 761 | * Control the animation to run when a window's state changes. Return a |
| 762 | * non-0 number to force the animation to a specific resource ID, or 0 |
| 763 | * to use the default animation. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 764 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 765 | * @param win The window that is changing. |
| 766 | * @param transit What is happening to the window: {@link #TRANSIT_ENTER}, |
| 767 | * {@link #TRANSIT_EXIT}, {@link #TRANSIT_SHOW}, or |
| 768 | * {@link #TRANSIT_HIDE}. |
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 | * @return Resource ID of the actual animation to use, or 0 for none. |
| 771 | */ |
| 772 | public int selectAnimationLw(WindowState win, int transit); |
| 773 | |
| 774 | /** |
Craig Mautner | 3c17437 | 2013-02-21 17:54:37 -0800 | [diff] [blame] | 775 | * Determine the animation to run for a rotation transition based on the |
| 776 | * top fullscreen windows {@link WindowManager.LayoutParams#rotationAnimation} |
| 777 | * and whether it is currently fullscreen and frontmost. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 778 | * |
| 779 | * @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] | 780 | * entering animation resource id is stored in anim[1]. |
| 781 | */ |
| 782 | public void selectRotationAnimationLw(int anim[]); |
| 783 | |
| 784 | /** |
| 785 | * Validate whether the current top fullscreen has specified the same |
| 786 | * {@link WindowManager.LayoutParams#rotationAnimation} value as that |
| 787 | * being passed in from the previous top fullscreen window. |
| 788 | * |
| 789 | * @param exitAnimId exiting resource id from the previous window. |
| 790 | * @param enterAnimId entering resource id from the previous window. |
| 791 | * @param forceDefault For rotation animations only, if true ignore the |
| 792 | * animation values and just return false. |
| 793 | * @return true if the previous values are still valid, false if they |
| 794 | * should be replaced with the default. |
| 795 | */ |
| 796 | public boolean validateRotationAnimationLw(int exitAnimId, int enterAnimId, |
| 797 | boolean forceDefault); |
| 798 | |
| 799 | /** |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 800 | * Create and return an animation to re-display a force hidden window. |
| 801 | */ |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 802 | public Animation createForceHideEnterAnimation(boolean onWallpaper, |
| 803 | boolean goingToNotificationShade); |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 804 | |
| 805 | /** |
| 806 | * Create and return an animation to let the wallpaper disappear after being shown on a force |
| 807 | * hiding window. |
| 808 | */ |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 809 | public Animation createForceHideWallpaperExitAnimation(boolean goingToNotificationShade); |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 810 | |
Dianne Hackborn | 3b3e145 | 2009-09-24 19:22:12 -0700 | [diff] [blame] | 811 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 812 | * 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] | 813 | * |
| 814 | * <p>There are some actions that need to be handled here because they |
| 815 | * affect the power state of the device, for example, the power keys. |
| 816 | * Generally, it's best to keep as little as possible in the queue thread |
| 817 | * because it's the most fragile. |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 818 | * @param event The key event. |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 819 | * @param policyFlags The policy flags associated with the key. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 820 | * |
Jeff Brown | 2687550 | 2014-01-30 21:47:47 -0800 | [diff] [blame] | 821 | * @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] | 822 | */ |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 823 | public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags); |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 824 | |
| 825 | /** |
Michael Wright | 70af00a | 2014-09-03 19:30:20 -0700 | [diff] [blame] | 826 | * Called from the input reader thread before a motion is enqueued when the device is in a |
| 827 | * non-interactive state. |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 828 | * |
| 829 | * <p>There are some actions that need to be handled here because they |
| 830 | * affect the power state of the device, for example, waking on motions. |
| 831 | * Generally, it's best to keep as little as possible in the queue thread |
| 832 | * because it's the most fragile. |
| 833 | * @param policyFlags The policy flags associated with the motion. |
| 834 | * |
Jeff Brown | 2687550 | 2014-01-30 21:47:47 -0800 | [diff] [blame] | 835 | * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}. |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 836 | */ |
Michael Wright | 70af00a | 2014-09-03 19:30:20 -0700 | [diff] [blame] | 837 | public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags); |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 838 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 839 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 840 | * 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] | 841 | * |
| 842 | * <p>Allows you to define |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 843 | * behavior for keys that can not be overridden by applications. |
| 844 | * This method is called from the input thread, with no locks held. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 845 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 846 | * @param win The window that currently has focus. This is where the key |
| 847 | * event will normally go. |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 848 | * @param event The key event. |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 849 | * @param policyFlags The policy flags associated with the key. |
Jeff Brown | d5bb82d | 2011-10-12 13:57:59 -0700 | [diff] [blame] | 850 | * @return 0 if the key should be dispatched immediately, -1 if the key should |
| 851 | * not be dispatched ever, or a positive value indicating the number of |
| 852 | * milliseconds by which the key dispatch should be delayed before trying |
| 853 | * again. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 854 | */ |
Jeff Brown | d5bb82d | 2011-10-12 13:57:59 -0700 | [diff] [blame] | 855 | public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 856 | |
| 857 | /** |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 858 | * Called from the input dispatcher thread when an application did not handle |
| 859 | * a key that was dispatched to it. |
| 860 | * |
| 861 | * <p>Allows you to define default global behavior for keys that were not handled |
| 862 | * 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] | 863 | * |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 864 | * @param win The window that currently has focus. This is where the key |
| 865 | * event will normally go. |
Jeff Brown | 1f24510 | 2010-11-18 20:53:46 -0800 | [diff] [blame] | 866 | * @param event The key event. |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 867 | * @param policyFlags The policy flags associated with the key. |
Jeff Brown | 49ed71d | 2010-12-06 17:13:33 -0800 | [diff] [blame] | 868 | * @return Returns an alternate key event to redispatch as a fallback, or null to give up. |
| 869 | * The caller is responsible for recycling the key event. |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 870 | */ |
Jeff Brown | 49ed71d | 2010-12-06 17:13:33 -0800 | [diff] [blame] | 871 | public KeyEvent dispatchUnhandledKey(WindowState win, KeyEvent event, int policyFlags); |
Jeff Brown | 3915bb8 | 2010-11-05 15:02:16 -0700 | [diff] [blame] | 872 | |
| 873 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 874 | * Called when layout of the windows is about to start. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 875 | * |
Craig Mautner | 69b0818 | 2012-09-05 13:07:13 -0700 | [diff] [blame] | 876 | * @param isDefaultDisplay true if window is on {@link Display#DEFAULT_DISPLAY}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 877 | * @param displayWidth The current full width of the screen. |
| 878 | * @param displayHeight The current full height of the screen. |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 879 | * @param displayRotation The current rotation being applied to the base window. |
| 880 | * @param uiMode The current uiMode in configuration. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 881 | */ |
Craig Mautner | 69b0818 | 2012-09-05 13:07:13 -0700 | [diff] [blame] | 882 | public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight, |
Sriram Viswanathan | 9ebbe6a | 2015-11-16 17:59:22 -0800 | [diff] [blame] | 883 | int displayRotation, int uiMode); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 884 | |
| 885 | /** |
John Spurlock | 4664623 | 2013-09-30 22:32:42 -0400 | [diff] [blame] | 886 | * Returns the bottom-most layer of the system decor, above which no policy decor should |
| 887 | * be applied. |
Dianne Hackborn | 85afd1b | 2012-05-13 13:31:06 -0700 | [diff] [blame] | 888 | */ |
John Spurlock | 4664623 | 2013-09-30 22:32:42 -0400 | [diff] [blame] | 889 | public int getSystemDecorLayerLw(); |
Dianne Hackborn | 85afd1b | 2012-05-13 13:31:06 -0700 | [diff] [blame] | 890 | |
| 891 | /** |
Craig Mautner | 967212c | 2013-04-13 21:10:58 -0700 | [diff] [blame] | 892 | * Return the rectangle of the screen that is available for applications to run in. |
| 893 | * This will be called immediately after {@link #beginLayoutLw}. |
| 894 | * |
| 895 | * @param r The rectangle to be filled with the boundaries available to applications. |
| 896 | */ |
| 897 | public void getContentRectLw(Rect r); |
| 898 | |
| 899 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 900 | * Called for each window attached to the window manager as layout is |
| 901 | * proceeding. The implementation of this function must take care of |
| 902 | * setting the window's frame, either here or in finishLayout(). |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 903 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 904 | * @param win The window being positioned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 905 | * @param attached For sub-windows, the window it is attached to; this |
| 906 | * window will already have had layoutWindow() called on it |
| 907 | * so you can use its Rect. Otherwise null. |
| 908 | */ |
Craig Mautner | c9457fa | 2014-06-06 14:27:48 -0700 | [diff] [blame] | 909 | public void layoutWindowLw(WindowState win, WindowState attached); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 910 | |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 911 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 912 | /** |
| 913 | * Return the insets for the areas covered by system windows. These values |
| 914 | * are computed on the most recent layout, so they are not guaranteed to |
| 915 | * be correct. |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 916 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 917 | * @param attrs The LayoutParams of the window. |
Filip Gruszczynski | 0ec1328 | 2015-06-25 11:26:01 -0700 | [diff] [blame] | 918 | * @param rotation Rotation of the display. |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 919 | * @param outContentInsets The areas covered by system windows, expressed as positive insets. |
| 920 | * @param outStableInsets The areas covered by stable system windows irrespective of their |
| 921 | * current visibility. Expressed as positive insets. |
Filip Gruszczynski | 0ec1328 | 2015-06-25 11:26:01 -0700 | [diff] [blame] | 922 | * @param outOutsets The areas that are not real display, but we would like to treat as such. |
Adrian Roos | 37d7a68 | 2014-11-06 18:15:16 +0100 | [diff] [blame] | 923 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 924 | */ |
Filip Gruszczynski | 0ec1328 | 2015-06-25 11:26:01 -0700 | [diff] [blame] | 925 | public void getInsetHintLw(WindowManager.LayoutParams attrs, int rotation, |
| 926 | Rect outContentInsets, Rect outStableInsets, Rect outOutsets); |
Dianne Hackborn | 85afd1b | 2012-05-13 13:31:06 -0700 | [diff] [blame] | 927 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 928 | /** |
| 929 | * Called when layout of the windows is finished. After this function has |
| 930 | * returned, all windows given to layoutWindow() <em>must</em> have had a |
| 931 | * frame assigned. |
| 932 | */ |
Craig Mautner | 61ac6bb | 2012-02-02 17:29:33 -0800 | [diff] [blame] | 933 | public void finishLayoutLw(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 934 | |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 935 | /** Layout state may have changed (so another layout will be performed) */ |
| 936 | static final int FINISH_LAYOUT_REDO_LAYOUT = 0x0001; |
| 937 | /** Configuration state may have changed */ |
| 938 | static final int FINISH_LAYOUT_REDO_CONFIG = 0x0002; |
| 939 | /** Wallpaper may need to move */ |
| 940 | static final int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004; |
Dianne Hackborn | b8b11a0 | 2010-03-10 15:53:11 -0800 | [diff] [blame] | 941 | /** Need to recompute animations */ |
| 942 | static final int FINISH_LAYOUT_REDO_ANIM = 0x0008; |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 943 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 944 | /** |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 945 | * Called following layout of all windows before each window has policy applied. |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 946 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 947 | * @param displayWidth The current full width of the screen. |
| 948 | * @param displayHeight The current full height of the screen. |
| 949 | */ |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 950 | public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 951 | |
| 952 | /** |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 953 | * Called following layout of all window to apply policy to each window. |
Yohei Yukawa | d1a0922 | 2015-06-30 16:22:05 -0700 | [diff] [blame] | 954 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 955 | * @param win The window being positioned. |
Yohei Yukawa | d1a0922 | 2015-06-30 16:22:05 -0700 | [diff] [blame] | 956 | * @param attrs The LayoutParams of the window. |
| 957 | * @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] | 958 | */ |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 959 | public void applyPostLayoutPolicyLw(WindowState win, |
Yohei Yukawa | d1a0922 | 2015-06-30 16:22:05 -0700 | [diff] [blame] | 960 | WindowManager.LayoutParams attrs, WindowState attached); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 961 | |
| 962 | /** |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 963 | * Called following layout of all windows and after policy has been applied |
| 964 | * to each window. If in this function you do |
| 965 | * something that may have modified the animation state of another window, |
| 966 | * 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] | 967 | * |
Dianne Hackborn | b8b11a0 | 2010-03-10 15:53:11 -0800 | [diff] [blame] | 968 | * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT}, |
| 969 | * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER}, |
| 970 | * or {@link #FINISH_LAYOUT_REDO_ANIM}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 971 | */ |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 972 | public int finishPostLayoutPolicyLw(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 973 | |
| 974 | /** |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 975 | * Return true if it is okay to perform animations for an app transition |
| 976 | * that is about to occur. You may return false for this if, for example, |
| 977 | * the lock screen is currently displayed so the switch should happen |
| 978 | * immediately. |
| 979 | */ |
| 980 | public boolean allowAppAnimationsLw(); |
Joe Onorato | 664644d | 2011-01-23 17:53:23 -0800 | [diff] [blame] | 981 | |
| 982 | |
| 983 | /** |
| 984 | * A new window has been focused. |
| 985 | */ |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 986 | public int focusChangedLw(WindowState lastFocus, WindowState newFocus); |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 987 | |
| 988 | /** |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 989 | * Called when the device has started waking up. |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 990 | */ |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 991 | public void startedWakingUp(); |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 992 | |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 993 | /** |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 994 | * Called when the device has finished waking up. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 995 | */ |
Jeff Brown | 416c49c | 2015-05-26 19:50:18 -0700 | [diff] [blame] | 996 | public void finishedWakingUp(); |
| 997 | |
| 998 | /** |
| 999 | * Called when the device has started going to sleep. |
| 1000 | * |
| 1001 | * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN}, |
| 1002 | * or {@link #OFF_BECAUSE_OF_TIMEOUT}. |
| 1003 | */ |
| 1004 | public void startedGoingToSleep(int why); |
| 1005 | |
| 1006 | /** |
| 1007 | * Called when the device has finished going to sleep. |
| 1008 | * |
| 1009 | * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN}, |
| 1010 | * or {@link #OFF_BECAUSE_OF_TIMEOUT}. |
| 1011 | */ |
| 1012 | public void finishedGoingToSleep(int why); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1013 | |
Jeff Brown | 36c4db8 | 2014-09-19 12:05:31 -0700 | [diff] [blame] | 1014 | /** |
| 1015 | * Called when the device is about to turn on the screen to show content. |
| 1016 | * When waking up, this method will be called once after the call to wakingUp(). |
| 1017 | * When dozing, the method will be called sometime after the call to goingToSleep() and |
| 1018 | * may be called repeatedly in the case where the screen is pulsing on and off. |
| 1019 | * |
| 1020 | * Must call back on the listener to tell it when the higher-level system |
| 1021 | * is ready for the screen to go on (i.e. the lock screen is shown). |
| 1022 | */ |
| 1023 | public void screenTurningOn(ScreenOnListener screenOnListener); |
| 1024 | |
Jeff Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1025 | /** |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 1026 | * Called when the device has actually turned on the screen, i.e. the display power state has |
| 1027 | * been set to ON and the screen is unblocked. |
| 1028 | */ |
| 1029 | public void screenTurnedOn(); |
| 1030 | |
| 1031 | /** |
Jeff Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1032 | * Called when the device has turned the screen off. |
| 1033 | */ |
| 1034 | public void screenTurnedOff(); |
| 1035 | |
Dianne Hackborn | 38e29a6 | 2011-09-18 14:43:08 -0700 | [diff] [blame] | 1036 | public interface ScreenOnListener { |
| 1037 | void onScreenOn(); |
Craig Mautner | 61ac6bb | 2012-02-02 17:29:33 -0800 | [diff] [blame] | 1038 | } |
Dianne Hackborn | 38e29a6 | 2011-09-18 14:43:08 -0700 | [diff] [blame] | 1039 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1040 | /** |
Jeff Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1041 | * 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] | 1042 | */ |
Jeff Brown | 3ee549c | 2014-09-22 20:14:39 -0700 | [diff] [blame] | 1043 | public boolean isScreenOn(); |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1044 | |
Dianne Hackborn | de2606d | 2009-12-18 16:53:55 -0800 | [diff] [blame] | 1045 | /** |
Jeff Brown | 00fa7bd | 2010-07-02 15:37:36 -0700 | [diff] [blame] | 1046 | * Tell the policy that the lid switch has changed state. |
| 1047 | * @param whenNanos The time when the change occurred in uptime nanoseconds. |
| 1048 | * @param lidOpen True if the lid is now open. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1049 | */ |
Jeff Brown | 46b9ac0 | 2010-04-22 18:58:52 -0700 | [diff] [blame] | 1050 | public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen); |
Michael Wright | 3818c92 | 2014-09-02 13:59:07 -0700 | [diff] [blame] | 1051 | |
| 1052 | /** |
| 1053 | * Tell the policy that the camera lens has been covered or uncovered. |
| 1054 | * @param whenNanos The time when the change occurred in uptime nanoseconds. |
| 1055 | * @param lensCovered True if the lens is covered. |
| 1056 | */ |
| 1057 | public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered); |
| 1058 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1059 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1060 | * Tell the policy if anyone is requesting that keyguard not come on. |
| 1061 | * |
| 1062 | * @param enabled Whether keyguard can be on or not. does not actually |
| 1063 | * turn it on, unless it was previously disabled with this function. |
| 1064 | * |
| 1065 | * @see android.app.KeyguardManager.KeyguardLock#disableKeyguard() |
| 1066 | * @see android.app.KeyguardManager.KeyguardLock#reenableKeyguard() |
| 1067 | */ |
Craig Mautner | 3c17437 | 2013-02-21 17:54:37 -0800 | [diff] [blame] | 1068 | @SuppressWarnings("javadoc") |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1069 | public void enableKeyguard(boolean enabled); |
| 1070 | |
| 1071 | /** |
| 1072 | * Callback used by {@link WindowManagerPolicy#exitKeyguardSecurely} |
| 1073 | */ |
| 1074 | interface OnKeyguardExitResult { |
| 1075 | void onKeyguardExitResult(boolean success); |
| 1076 | } |
| 1077 | |
| 1078 | /** |
| 1079 | * Tell the policy if anyone is requesting the keyguard to exit securely |
| 1080 | * (this would be called after the keyguard was disabled) |
| 1081 | * @param callback Callback to send the result back. |
| 1082 | * @see android.app.KeyguardManager#exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult) |
| 1083 | */ |
Craig Mautner | 3c17437 | 2013-02-21 17:54:37 -0800 | [diff] [blame] | 1084 | @SuppressWarnings("javadoc") |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1085 | void exitKeyguardSecurely(OnKeyguardExitResult callback); |
| 1086 | |
| 1087 | /** |
Mike Lockwood | 520d8bc | 2011-02-18 13:23:13 -0500 | [diff] [blame] | 1088 | * isKeyguardLocked |
| 1089 | * |
| 1090 | * Return whether the keyguard is currently locked. |
| 1091 | * |
| 1092 | * @return true if in keyguard is locked. |
| 1093 | */ |
| 1094 | public boolean isKeyguardLocked(); |
| 1095 | |
| 1096 | /** |
| 1097 | * isKeyguardSecure |
| 1098 | * |
| 1099 | * Return whether the keyguard requires a password to unlock. |
| 1100 | * |
| 1101 | * @return true if in keyguard is secure. |
| 1102 | */ |
| 1103 | public boolean isKeyguardSecure(); |
| 1104 | |
| 1105 | /** |
Adrian Roos | 461829d | 2015-06-03 14:41:18 -0700 | [diff] [blame] | 1106 | * Return whether the keyguard is on. |
| 1107 | * |
| 1108 | * @return true if in keyguard is on. |
| 1109 | */ |
| 1110 | public boolean isKeyguardShowingOrOccluded(); |
| 1111 | |
| 1112 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1113 | * inKeyguardRestrictedKeyInputMode |
| 1114 | * |
| 1115 | * if keyguard screen is showing or in restricted key input mode (i.e. in |
| 1116 | * keyguard password emergency screen). When in such mode, certain keys, |
| 1117 | * such as the Home key and the right soft keys, don't work. |
| 1118 | * |
| 1119 | * @return true if in keyguard restricted input mode. |
| 1120 | */ |
| 1121 | public boolean inKeyguardRestrictedKeyInputMode(); |
| 1122 | |
| 1123 | /** |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 1124 | * Ask the policy to dismiss the keyguard, if it is currently shown. |
| 1125 | */ |
| 1126 | public void dismissKeyguardLw(); |
| 1127 | |
| 1128 | /** |
Jorim Jaggi | 8de4311c | 2014-08-11 22:36:20 +0200 | [diff] [blame] | 1129 | * Notifies the keyguard that the activity has drawn it was waiting for. |
| 1130 | */ |
| 1131 | public void notifyActivityDrawnForKeyguardLw(); |
| 1132 | |
| 1133 | /** |
Jorim Jaggi | cff0acb | 2014-03-31 16:35:15 +0200 | [diff] [blame] | 1134 | * Ask the policy whether the Keyguard has drawn. If the Keyguard is disabled, this method |
| 1135 | * returns true as soon as we know that Keyguard is disabled. |
| 1136 | * |
| 1137 | * @return true if the keyguard has drawn. |
| 1138 | */ |
| 1139 | public boolean isKeyguardDrawnLw(); |
| 1140 | |
| 1141 | /** |
Jeff Brown | 01a98dd | 2011-09-20 15:08:29 -0700 | [diff] [blame] | 1142 | * Given an orientation constant, returns the appropriate surface rotation, |
| 1143 | * taking into account sensors, docking mode, rotation lock, and other factors. |
| 1144 | * |
| 1145 | * @param orientation An orientation constant, such as |
| 1146 | * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}. |
| 1147 | * @param lastRotation The most recently used rotation. |
| 1148 | * @return The surface rotation to use. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1149 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1150 | public int rotationForOrientationLw(@ActivityInfo.ScreenOrientation int orientation, |
| 1151 | int lastRotation); |
Jeff Brown | 01a98dd | 2011-09-20 15:08:29 -0700 | [diff] [blame] | 1152 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1153 | /** |
Jeff Brown | 01a98dd | 2011-09-20 15:08:29 -0700 | [diff] [blame] | 1154 | * Given an orientation constant and a rotation, returns true if the rotation |
| 1155 | * has compatible metrics to the requested orientation. For example, if |
| 1156 | * the application requested landscape and got seascape, then the rotation |
| 1157 | * has compatible metrics; if the application requested portrait and got landscape, |
| 1158 | * then the rotation has incompatible metrics; if the application did not specify |
| 1159 | * a preference, then anything goes. |
| 1160 | * |
| 1161 | * @param orientation An orientation constant, such as |
| 1162 | * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}. |
| 1163 | * @param rotation The rotation to check. |
| 1164 | * @return True if the rotation is compatible with the requested orientation. |
Dianne Hackborn | dacea8c | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 1165 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1166 | public boolean rotationHasCompatibleMetricsLw(@ActivityInfo.ScreenOrientation int orientation, |
| 1167 | int rotation); |
Dianne Hackborn | dacea8c | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 1168 | |
| 1169 | /** |
Jeff Brown | c0347aa | 2011-09-23 17:26:09 -0700 | [diff] [blame] | 1170 | * Called by the window manager when the rotation changes. |
| 1171 | * |
| 1172 | * @param rotation The new rotation. |
| 1173 | */ |
| 1174 | public void setRotationLw(int rotation); |
| 1175 | |
| 1176 | /** |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 1177 | * 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] | 1178 | * the system should go into safe mode. |
| 1179 | */ |
Jeff Brown | ac14351 | 2012-04-05 18:57:33 -0700 | [diff] [blame] | 1180 | public void setSafeMode(boolean safeMode); |
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 | /** |
| 1183 | * Called when the system is mostly done booting. |
| 1184 | */ |
| 1185 | public void systemReady(); |
| 1186 | |
| 1187 | /** |
Dianne Hackborn | ba24e4d | 2011-09-01 11:17:06 -0700 | [diff] [blame] | 1188 | * Called when the system is done booting to the point where the |
| 1189 | * user can start interacting with it. |
| 1190 | */ |
| 1191 | public void systemBooted(); |
| 1192 | |
| 1193 | /** |
Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 1194 | * Show boot time message to the user. |
| 1195 | */ |
| 1196 | public void showBootMessage(final CharSequence msg, final boolean always); |
| 1197 | |
| 1198 | /** |
| 1199 | * Hide the UI for showing boot messages, never to be displayed again. |
| 1200 | */ |
| 1201 | public void hideBootMessages(); |
| 1202 | |
| 1203 | /** |
Mike Lockwood | ef73162 | 2010-01-27 17:51:34 -0500 | [diff] [blame] | 1204 | * Called when userActivity is signalled in the power manager. |
| 1205 | * This is safe to call from any thread, with any window manager locks held or not. |
| 1206 | */ |
| 1207 | public void userActivity(); |
| 1208 | |
| 1209 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1210 | * Called when we have finished booting and can now display the home |
Jeff Brown | c042ee2 | 2012-05-08 13:03:42 -0700 | [diff] [blame] | 1211 | * 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] | 1212 | * this point the display is active. |
| 1213 | */ |
| 1214 | public void enableScreenAfterBoot(); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1215 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1216 | public void setCurrentOrientationLw(@ActivityInfo.ScreenOrientation int newOrientation); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1217 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1218 | /** |
| 1219 | * Call from application to perform haptic feedback on its window. |
| 1220 | */ |
The Android Open Source Project | c39a6e0 | 2009-03-11 12:11:56 -0700 | [diff] [blame] | 1221 | public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always); |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1222 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1223 | /** |
Daniel Sandler | 0601eb7 | 2011-04-13 01:01:32 -0400 | [diff] [blame] | 1224 | * Called when we have started keeping the screen on because a window |
| 1225 | * requesting this has become visible. |
| 1226 | */ |
Jeff Brown | c38c9be | 2012-10-04 13:16:19 -0700 | [diff] [blame] | 1227 | public void keepScreenOnStartedLw(); |
Daniel Sandler | 0601eb7 | 2011-04-13 01:01:32 -0400 | [diff] [blame] | 1228 | |
| 1229 | /** |
| 1230 | * 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] | 1231 | * requesting this is no longer visible. |
| 1232 | */ |
Jeff Brown | c38c9be | 2012-10-04 13:16:19 -0700 | [diff] [blame] | 1233 | public void keepScreenOnStoppedLw(); |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 1234 | |
| 1235 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1236 | * Gets the current user rotation mode. |
Svetoslav Ganov | 80943d8 | 2013-01-02 10:25:37 -0800 | [diff] [blame] | 1237 | * |
| 1238 | * @return The rotation mode. |
| 1239 | * |
| 1240 | * @see WindowManagerPolicy#USER_ROTATION_LOCKED |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1241 | * @see WindowManagerPolicy#USER_ROTATION_FREE |
Svetoslav Ganov | 80943d8 | 2013-01-02 10:25:37 -0800 | [diff] [blame] | 1242 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1243 | @UserRotationMode |
Svetoslav Ganov | 80943d8 | 2013-01-02 10:25:37 -0800 | [diff] [blame] | 1244 | public int getUserRotationMode(); |
| 1245 | |
| 1246 | /** |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1247 | * 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] | 1248 | * |
| 1249 | * @param mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or |
Filip Gruszczynski | 2a6a2c2 | 2015-10-14 12:00:53 -0700 | [diff] [blame] | 1250 | * {@link WindowManagerPolicy#USER_ROTATION_FREE}. |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 1251 | * @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90}, |
Craig Mautner | 69b0818 | 2012-09-05 13:07:13 -0700 | [diff] [blame] | 1252 | * {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}. |
Daniel Sandler | b73617d | 2010-08-17 00:41:00 -0400 | [diff] [blame] | 1253 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1254 | public void setUserRotationMode(@UserRotationMode int mode, @Surface.Rotation int rotation); |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 1255 | |
| 1256 | /** |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 1257 | * Called when a new system UI visibility is being reported, allowing |
| 1258 | * the policy to adjust what is actually reported. |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1259 | * @param visibility The raw visibility reported by the status bar. |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 1260 | * @return The new desired visibility. |
| 1261 | */ |
| 1262 | public int adjustSystemUiVisibilityLw(int visibility); |
| 1263 | |
| 1264 | /** |
Daniel Sandler | 0c4ccff | 2011-10-19 16:39:14 -0400 | [diff] [blame] | 1265 | * Specifies whether there is an on-screen navigation bar separate from the status bar. |
| 1266 | */ |
| 1267 | public boolean hasNavigationBar(); |
| 1268 | |
| 1269 | /** |
Jim Miller | 93c518e | 2012-01-17 15:55:31 -0800 | [diff] [blame] | 1270 | * Lock the device now. |
| 1271 | */ |
Adam Cohen | f752202 | 2012-10-03 20:03:18 -0700 | [diff] [blame] | 1272 | public void lockNow(Bundle options); |
Jim Miller | 93c518e | 2012-01-17 15:55:31 -0800 | [diff] [blame] | 1273 | |
| 1274 | /** |
satok | 1bc0a49 | 2012-04-25 22:47:12 +0900 | [diff] [blame] | 1275 | * Set the last used input method window state. This state is used to make IME transition |
| 1276 | * smooth. |
| 1277 | * @hide |
| 1278 | */ |
| 1279 | public void setLastInputMethodWindowLw(WindowState ime, WindowState target); |
| 1280 | |
| 1281 | /** |
Craig Mautner | 84984fa | 2014-06-19 11:19:20 -0700 | [diff] [blame] | 1282 | * Show the recents task list app. |
| 1283 | * @hide |
| 1284 | */ |
| 1285 | public void showRecentApps(); |
| 1286 | |
| 1287 | /** |
Alan Viverette | e34560b2 | 2014-07-10 14:50:06 -0700 | [diff] [blame] | 1288 | * Show the global actions dialog. |
| 1289 | * @hide |
| 1290 | */ |
| 1291 | public void showGlobalActions(); |
| 1292 | |
| 1293 | /** |
Satoshi Kataoka | 658c7b8 | 2013-10-10 17:03:51 +0900 | [diff] [blame] | 1294 | * @return The current height of the input method window. |
| 1295 | */ |
| 1296 | public int getInputMethodWindowVisibleHeightLw(); |
| 1297 | |
| 1298 | /** |
Craig Mautner | f1b6741 | 2012-09-19 13:18:29 -0700 | [diff] [blame] | 1299 | * Called when the current user changes. Guaranteed to be called before the broadcast |
| 1300 | * of the new user id is made to all listeners. |
| 1301 | * |
| 1302 | * @param newUserId The id of the incoming user. |
| 1303 | */ |
| 1304 | public void setCurrentUserLw(int newUserId); |
Svetoslav Ganov | 1cf70bb | 2012-08-06 10:53:34 -0700 | [diff] [blame] | 1305 | |
| 1306 | /** |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 1307 | * Print the WindowManagerPolicy's state into the given stream. |
| 1308 | * |
| 1309 | * @param prefix Text to print at the front of each line. |
Dianne Hackborn | f99f9c5 | 2011-01-12 15:49:25 -0800 | [diff] [blame] | 1310 | * @param writer The PrintWriter to which you should dump your state. This will be |
| 1311 | * closed for you after you return. |
| 1312 | * @param args additional arguments to the dump request. |
| 1313 | */ |
Jeff Brown | d7a04de | 2012-06-17 14:17:52 -0700 | [diff] [blame] | 1314 | public void dump(String prefix, PrintWriter writer, String[] args); |
Jim Miller | 4eeb4f6 | 2012-11-08 00:04:29 -0800 | [diff] [blame] | 1315 | |
| 1316 | /** |
Svetoslav Ganov | 545252f | 2012-12-10 18:29:24 -0800 | [diff] [blame] | 1317 | * Returns whether a given window type can be magnified. |
| 1318 | * |
| 1319 | * @param windowType The window type. |
| 1320 | * @return True if the window can be magnified. |
| 1321 | */ |
| 1322 | public boolean canMagnifyWindow(int windowType); |
| 1323 | |
| 1324 | /** |
| 1325 | * Returns whether a given window type is considered a top level one. |
| 1326 | * A top level window does not have a container, i.e. attached window, |
| 1327 | * or if it has a container it is laid out as a top-level window, not |
| 1328 | * as a child of its container. |
| 1329 | * |
| 1330 | * @param windowType The window type. |
| 1331 | * @return True if the window is a top level one. |
| 1332 | */ |
| 1333 | public boolean isTopLevelWindow(int windowType); |
Jorim Jaggi | 0d67462 | 2014-05-21 01:34:15 +0200 | [diff] [blame] | 1334 | |
| 1335 | /** |
| 1336 | * Notifies the keyguard to start fading out. |
Jorim Jaggi | e29b2db | 2014-05-30 23:17:03 +0200 | [diff] [blame] | 1337 | * |
| 1338 | * @param startTime the start time of the animation in uptime milliseconds |
| 1339 | * @param fadeoutDuration the duration of the exit animation, in milliseconds |
Jorim Jaggi | 0d67462 | 2014-05-21 01:34:15 +0200 | [diff] [blame] | 1340 | */ |
Jorim Jaggi | e29b2db | 2014-05-30 23:17:03 +0200 | [diff] [blame] | 1341 | public void startKeyguardExitAnimation(long startTime, long fadeoutDuration); |
Jorim Jaggi | 737af72 | 2015-12-31 10:42:27 +0100 | [diff] [blame] | 1342 | |
| 1343 | /** |
| 1344 | * Calculates the stable insets without running a layout. |
| 1345 | * |
| 1346 | * @param displayRotation the current display rotation |
Jorim Jaggi | 737af72 | 2015-12-31 10:42:27 +0100 | [diff] [blame] | 1347 | * @param displayWidth the current display width |
| 1348 | * @param displayHeight the current display height |
Winson | 3e87474 | 2016-01-07 10:08:17 -0800 | [diff] [blame] | 1349 | * @param outInsets the insets to return |
Jorim Jaggi | 737af72 | 2015-12-31 10:42:27 +0100 | [diff] [blame] | 1350 | */ |
| 1351 | public void getStableInsetsLw(int displayRotation, int displayWidth, int displayHeight, |
| 1352 | Rect outInsets); |
Jorim Jaggi | 82c9dc9 | 2016-02-05 15:10:33 -0800 | [diff] [blame] | 1353 | |
| 1354 | /** |
| 1355 | * Calculates the insets for the areas that could never be removed in Honeycomb, i.e. system |
| 1356 | * bar or button bar. See {@link #getNonDecorDisplayWidth}. |
| 1357 | * |
| 1358 | * @param displayRotation the current display rotation |
| 1359 | * @param displayWidth the current display width |
| 1360 | * @param displayHeight the current display height |
| 1361 | * @param outInsets the insets to return |
| 1362 | */ |
| 1363 | public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight, |
| 1364 | Rect outInsets); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1365 | } |