Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 1 | /* |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 2 | * Copyright (C) 2017 The Android Open Source Project |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 17 | package com.android.server.wm; |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 18 | |
Alan Viverette | 59e53a1 | 2016-03-28 13:41:32 -0400 | [diff] [blame] | 19 | import android.annotation.NonNull; |
Alan Viverette | 214fb68 | 2015-11-17 09:47:11 -0500 | [diff] [blame] | 20 | import android.annotation.Nullable; |
Daichi Hirono | 3c6c95e | 2017-09-13 12:23:57 +0900 | [diff] [blame] | 21 | import android.content.ClipData; |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 22 | import android.graphics.Rect; |
| 23 | import android.graphics.Region; |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 24 | import android.hardware.display.DisplayManagerInternal; |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 25 | import android.os.IBinder; |
Daichi Hirono | 4a54517 | 2018-02-01 10:59:48 +0900 | [diff] [blame] | 26 | import android.view.Display; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 27 | import android.view.IInputFilter; |
| 28 | import android.view.IWindow; |
Daichi Hirono | 4a54517 | 2018-02-01 10:59:48 +0900 | [diff] [blame] | 29 | import android.view.InputChannel; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 30 | import android.view.MagnificationSpec; |
| 31 | import android.view.WindowInfo; |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 32 | |
Daichi Hirono | 4a54517 | 2018-02-01 10:59:48 +0900 | [diff] [blame] | 33 | import com.android.server.input.InputManagerService; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 34 | import com.android.server.policy.WindowManagerPolicy; |
| 35 | |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 36 | import java.util.List; |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Window manager local system service interface. |
| 40 | * |
| 41 | * @hide Only for use within the system server. |
| 42 | */ |
| 43 | public abstract class WindowManagerInternal { |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 44 | |
| 45 | /** |
| 46 | * Interface to receive a callback when the windows reported for |
| 47 | * accessibility changed. |
| 48 | */ |
| 49 | public interface WindowsForAccessibilityCallback { |
| 50 | |
| 51 | /** |
| 52 | * Called when the windows for accessibility changed. |
| 53 | * |
| 54 | * @param windows The windows for accessibility. |
| 55 | */ |
| 56 | public void onWindowsForAccessibilityChanged(List<WindowInfo> windows); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Callbacks for contextual changes that affect the screen magnification |
| 61 | * feature. |
| 62 | */ |
| 63 | public interface MagnificationCallbacks { |
| 64 | |
| 65 | /** |
Phil Weaver | 7043924 | 2016-03-10 15:15:49 -0800 | [diff] [blame] | 66 | * Called when the region where magnification operates changes. Note that this isn't the |
| 67 | * entire screen. For example, IMEs are not magnified. |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 68 | * |
Phil Weaver | 7043924 | 2016-03-10 15:15:49 -0800 | [diff] [blame] | 69 | * @param magnificationRegion the current magnification region |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 70 | */ |
Phil Weaver | 7043924 | 2016-03-10 15:15:49 -0800 | [diff] [blame] | 71 | public void onMagnificationRegionChanged(Region magnificationRegion); |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 72 | |
| 73 | /** |
| 74 | * Called when an application requests a rectangle on the screen to allow |
| 75 | * the client to apply the appropriate pan and scale. |
| 76 | * |
| 77 | * @param left The rectangle left. |
| 78 | * @param top The rectangle top. |
| 79 | * @param right The rectangle right. |
| 80 | * @param bottom The rectangle bottom. |
| 81 | */ |
| 82 | public void onRectangleOnScreenRequested(int left, int top, int right, int bottom); |
| 83 | |
| 84 | /** |
| 85 | * Notifies that the rotation changed. |
| 86 | * |
| 87 | * @param rotation The current rotation. |
| 88 | */ |
| 89 | public void onRotationChanged(int rotation); |
| 90 | |
| 91 | /** |
| 92 | * Notifies that the context of the user changed. For example, an application |
| 93 | * was started. |
| 94 | */ |
| 95 | public void onUserContextChanged(); |
| 96 | } |
| 97 | |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 98 | /** |
Jorim Jaggi | 77ba480 | 2015-02-18 13:57:50 +0100 | [diff] [blame] | 99 | * Abstract class to be notified about {@link com.android.server.wm.AppTransition} events. Held |
| 100 | * as an abstract class so a listener only needs to implement the methods of its interest. |
| 101 | */ |
| 102 | public static abstract class AppTransitionListener { |
| 103 | |
| 104 | /** |
| 105 | * Called when an app transition is being setup and about to be executed. |
| 106 | */ |
| 107 | public void onAppTransitionPendingLocked() {} |
| 108 | |
| 109 | /** |
| 110 | * Called when a pending app transition gets cancelled. |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 111 | * |
| 112 | * @param transit transition type indicating what kind of transition got cancelled |
Jorim Jaggi | 77ba480 | 2015-02-18 13:57:50 +0100 | [diff] [blame] | 113 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 114 | public void onAppTransitionCancelledLocked(int transit) {} |
Jorim Jaggi | 77ba480 | 2015-02-18 13:57:50 +0100 | [diff] [blame] | 115 | |
| 116 | /** |
| 117 | * Called when an app transition gets started |
| 118 | * |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 119 | * @param transit transition type indicating what kind of transition gets run, must be one |
| 120 | * of AppTransition.TRANSIT_* values |
Jorim Jaggi | f5f9e12 | 2017-10-24 18:21:09 +0200 | [diff] [blame] | 121 | * @param duration the total duration of the transition |
| 122 | * @param statusBarAnimationStartTime the desired start time for all visual animations in |
| 123 | * the status bar caused by this app transition in uptime millis |
| 124 | * @param statusBarAnimationDuration the duration for all visual animations in the status |
| 125 | * bar caused by this app transition in millis |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 126 | * |
| 127 | * @return Return any bit set of {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_LAYOUT}, |
| 128 | * {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_CONFIG}, |
| 129 | * {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_WALLPAPER}, |
| 130 | * or {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_ANIM}. |
Jorim Jaggi | 77ba480 | 2015-02-18 13:57:50 +0100 | [diff] [blame] | 131 | */ |
Evan Rosky | 2289ba1 | 2018-11-19 18:28:18 -0800 | [diff] [blame] | 132 | public int onAppTransitionStartingLocked(int transit, long duration, |
| 133 | long statusBarAnimationStartTime, long statusBarAnimationDuration) { |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 134 | return 0; |
| 135 | } |
Jorim Jaggi | 77ba480 | 2015-02-18 13:57:50 +0100 | [diff] [blame] | 136 | |
| 137 | /** |
| 138 | * Called when an app transition is finished running. |
| 139 | * |
| 140 | * @param token the token for app whose transition has finished |
| 141 | */ |
| 142 | public void onAppTransitionFinishedLocked(IBinder token) {} |
| 143 | } |
| 144 | |
| 145 | /** |
Seigo Nonaka | 7309b12 | 2015-08-17 18:34:13 -0700 | [diff] [blame] | 146 | * An interface to be notified about hardware keyboard status. |
| 147 | */ |
| 148 | public interface OnHardKeyboardStatusChangeListener { |
| 149 | public void onHardKeyboardStatusChange(boolean available); |
| 150 | } |
| 151 | |
| 152 | /** |
Daichi Hirono | 3c6c95e | 2017-09-13 12:23:57 +0900 | [diff] [blame] | 153 | * An interface to customize drag and drop behaviors. |
| 154 | */ |
| 155 | public interface IDragDropCallback { |
Daichi Hirono | 4a54517 | 2018-02-01 10:59:48 +0900 | [diff] [blame] | 156 | default boolean registerInputChannel( |
| 157 | DragState state, Display display, InputManagerService service, |
| 158 | InputChannel source) { |
chaviw | b5e316c | 2018-12-26 15:39:15 -0800 | [diff] [blame] | 159 | state.mTransferTouchFromToken = source.getToken(); |
Daichi Hirono | 4a54517 | 2018-02-01 10:59:48 +0900 | [diff] [blame] | 160 | state.register(display); |
chaviw | b5e316c | 2018-12-26 15:39:15 -0800 | [diff] [blame] | 161 | return true; |
Daichi Hirono | 4a54517 | 2018-02-01 10:59:48 +0900 | [diff] [blame] | 162 | } |
| 163 | |
Daichi Hirono | 3c6c95e | 2017-09-13 12:23:57 +0900 | [diff] [blame] | 164 | /** |
Daichi Hirono | bb28efb | 2017-11-21 15:11:01 +0900 | [diff] [blame] | 165 | * Called when drag operation is starting. |
Daichi Hirono | 3c6c95e | 2017-09-13 12:23:57 +0900 | [diff] [blame] | 166 | */ |
Daichi Hirono | bb28efb | 2017-11-21 15:11:01 +0900 | [diff] [blame] | 167 | default boolean prePerformDrag(IWindow window, IBinder dragToken, |
Daichi Hirono | 3c6c95e | 2017-09-13 12:23:57 +0900 | [diff] [blame] | 168 | int touchSource, float touchX, float touchY, float thumbCenterX, float thumbCenterY, |
| 169 | ClipData data) { |
| 170 | return true; |
| 171 | } |
| 172 | |
| 173 | /** |
Daichi Hirono | bb28efb | 2017-11-21 15:11:01 +0900 | [diff] [blame] | 174 | * Called when drag operation is started. |
Daichi Hirono | 3c6c95e | 2017-09-13 12:23:57 +0900 | [diff] [blame] | 175 | */ |
Daichi Hirono | bb28efb | 2017-11-21 15:11:01 +0900 | [diff] [blame] | 176 | default void postPerformDrag() {} |
Daichi Hirono | 3c6c95e | 2017-09-13 12:23:57 +0900 | [diff] [blame] | 177 | |
| 178 | /** |
Daichi Hirono | bb28efb | 2017-11-21 15:11:01 +0900 | [diff] [blame] | 179 | * Called when drop result is being reported. |
Daichi Hirono | 3c6c95e | 2017-09-13 12:23:57 +0900 | [diff] [blame] | 180 | */ |
Daichi Hirono | bb28efb | 2017-11-21 15:11:01 +0900 | [diff] [blame] | 181 | default void preReportDropResult(IWindow window, boolean consumed) {} |
| 182 | |
| 183 | /** |
| 184 | * Called when drop result was reported. |
| 185 | */ |
| 186 | default void postReportDropResult() {} |
| 187 | |
| 188 | /** |
| 189 | * Called when drag operation is being cancelled. |
| 190 | */ |
| 191 | default void preCancelDragAndDrop(IBinder dragToken) {} |
| 192 | |
| 193 | /** |
| 194 | * Called when drag operation was cancelled. |
| 195 | */ |
| 196 | default void postCancelDragAndDrop() {} |
Daichi Hirono | 3c6c95e | 2017-09-13 12:23:57 +0900 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | /** |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 200 | * Request that the window manager call |
| 201 | * {@link DisplayManagerInternal#performTraversalInTransactionFromWindowManager} |
| 202 | * within a surface transaction at a later time. |
| 203 | */ |
| 204 | public abstract void requestTraversalFromDisplayManager(); |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 205 | |
| 206 | /** |
| 207 | * Set by the accessibility layer to observe changes in the magnified region, |
| 208 | * rotation, and other window transformations related to display magnification |
| 209 | * as the window manager is responsible for doing the actual magnification |
| 210 | * and has access to the raw window data while the accessibility layer serves |
| 211 | * as a controller. |
| 212 | * |
Rhed Jao | 02655dc | 2018-10-30 20:44:52 +0800 | [diff] [blame] | 213 | * @param displayId The logical display id. |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 214 | * @param callbacks The callbacks to invoke. |
Rhed Jao | 02655dc | 2018-10-30 20:44:52 +0800 | [diff] [blame] | 215 | * @return {@code false} if display id is not valid. |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 216 | */ |
Rhed Jao | 02655dc | 2018-10-30 20:44:52 +0800 | [diff] [blame] | 217 | public abstract boolean setMagnificationCallbacks(int displayId, |
| 218 | @Nullable MagnificationCallbacks callbacks); |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 219 | |
| 220 | /** |
| 221 | * Set by the accessibility layer to specify the magnification and panning to |
| 222 | * be applied to all windows that should be magnified. |
| 223 | * |
Rhed Jao | 02655dc | 2018-10-30 20:44:52 +0800 | [diff] [blame] | 224 | * @param displayId The logical display id. |
Craig Mautner | 8a0da01 | 2014-05-31 15:13:37 -0700 | [diff] [blame] | 225 | * @param spec The MagnficationSpec to set. |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 226 | * |
Rhed Jao | 02655dc | 2018-10-30 20:44:52 +0800 | [diff] [blame] | 227 | * @see #setMagnificationCallbacks(int, MagnificationCallbacks) |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 228 | */ |
Rhed Jao | 02655dc | 2018-10-30 20:44:52 +0800 | [diff] [blame] | 229 | public abstract void setMagnificationSpec(int displayId, MagnificationSpec spec); |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 230 | |
| 231 | /** |
Casey Burkhardt | 74922c6 | 2017-02-13 12:43:16 -0800 | [diff] [blame] | 232 | * Set by the accessibility framework to indicate whether the magnifiable regions of the display |
| 233 | * should be shown. |
| 234 | * |
Rhed Jao | 02655dc | 2018-10-30 20:44:52 +0800 | [diff] [blame] | 235 | * @param displayId The logical display id. |
Casey Burkhardt | 74922c6 | 2017-02-13 12:43:16 -0800 | [diff] [blame] | 236 | * @param show {@code true} to show magnifiable region bounds, {@code false} to hide |
| 237 | */ |
Rhed Jao | 02655dc | 2018-10-30 20:44:52 +0800 | [diff] [blame] | 238 | public abstract void setForceShowMagnifiableBounds(int displayId, boolean show); |
Casey Burkhardt | 74922c6 | 2017-02-13 12:43:16 -0800 | [diff] [blame] | 239 | |
| 240 | /** |
Phil Weaver | 7043924 | 2016-03-10 15:15:49 -0800 | [diff] [blame] | 241 | * Obtains the magnification regions. |
Alan Viverette | 59e53a1 | 2016-03-28 13:41:32 -0400 | [diff] [blame] | 242 | * |
Rhed Jao | 02655dc | 2018-10-30 20:44:52 +0800 | [diff] [blame] | 243 | * @param displayId The logical display id. |
Phil Weaver | 7043924 | 2016-03-10 15:15:49 -0800 | [diff] [blame] | 244 | * @param magnificationRegion the current magnification region |
Alan Viverette | 59e53a1 | 2016-03-28 13:41:32 -0400 | [diff] [blame] | 245 | */ |
Rhed Jao | 02655dc | 2018-10-30 20:44:52 +0800 | [diff] [blame] | 246 | public abstract void getMagnificationRegion(int displayId, @NonNull Region magnificationRegion); |
Alan Viverette | 59e53a1 | 2016-03-28 13:41:32 -0400 | [diff] [blame] | 247 | |
| 248 | /** |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 249 | * Gets the magnification and translation applied to a window given its token. |
| 250 | * Not all windows are magnified and the window manager policy determines which |
| 251 | * windows are magnified. The returned result also takes into account the compat |
| 252 | * scale if necessary. |
| 253 | * |
| 254 | * @param windowToken The window's token. |
| 255 | * |
| 256 | * @return The magnification spec for the window. |
| 257 | * |
Rhed Jao | 02655dc | 2018-10-30 20:44:52 +0800 | [diff] [blame] | 258 | * @see #setMagnificationCallbacks(int, MagnificationCallbacks) |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 259 | */ |
| 260 | public abstract MagnificationSpec getCompatibleMagnificationSpecForWindow( |
| 261 | IBinder windowToken); |
| 262 | |
| 263 | /** |
| 264 | * Sets a callback for observing which windows are touchable for the purposes |
| 265 | * of accessibility. |
| 266 | * |
| 267 | * @param callback The callback. |
| 268 | */ |
| 269 | public abstract void setWindowsForAccessibilityCallback( |
| 270 | WindowsForAccessibilityCallback callback); |
| 271 | |
| 272 | /** |
| 273 | * Sets a filter for manipulating the input event stream. |
| 274 | * |
| 275 | * @param filter The filter implementation. |
| 276 | */ |
| 277 | public abstract void setInputFilter(IInputFilter filter); |
| 278 | |
| 279 | /** |
| 280 | * Gets the token of the window that has input focus. |
| 281 | * |
| 282 | * @return The token. |
| 283 | */ |
| 284 | public abstract IBinder getFocusedWindowToken(); |
| 285 | |
| 286 | /** |
| 287 | * @return Whether the keyguard is engaged. |
| 288 | */ |
| 289 | public abstract boolean isKeyguardLocked(); |
| 290 | |
| 291 | /** |
Jonathan Solnit | 6e8d709 | 2017-06-15 15:17:20 -0700 | [diff] [blame] | 292 | * @return Whether the keyguard is showing and not occluded. |
| 293 | */ |
| 294 | public abstract boolean isKeyguardShowingAndNotOccluded(); |
| 295 | |
| 296 | /** |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 297 | * Gets the frame of a window given its token. |
| 298 | * |
| 299 | * @param token The token. |
| 300 | * @param outBounds The frame to populate. |
| 301 | */ |
| 302 | public abstract void getWindowFrame(IBinder token, Rect outBounds); |
Craig Mautner | 8a0da01 | 2014-05-31 15:13:37 -0700 | [diff] [blame] | 303 | |
| 304 | /** |
Alan Viverette | e34560b2 | 2014-07-10 14:50:06 -0700 | [diff] [blame] | 305 | * Opens the global actions dialog. |
| 306 | */ |
| 307 | public abstract void showGlobalActions(); |
| 308 | |
| 309 | /** |
Craig Mautner | 8a0da01 | 2014-05-31 15:13:37 -0700 | [diff] [blame] | 310 | * Invalidate all visible windows. Then report back on the callback once all windows have |
| 311 | * redrawn. |
| 312 | */ |
Craig Mautner | 13f6ea7 | 2014-06-23 14:57:02 -0700 | [diff] [blame] | 313 | public abstract void waitForAllWindowsDrawn(Runnable callback, long timeout); |
Svetoslav | 3a5c721 | 2014-10-14 09:54:26 -0700 | [diff] [blame] | 314 | |
| 315 | /** |
Adrian Roos | 595416b | 2018-10-14 14:50:33 +0200 | [diff] [blame] | 316 | * Overrides the display size. |
| 317 | * |
| 318 | * @param displayId The display to override the display size. |
| 319 | * @param width The width to override. |
| 320 | * @param height The height to override. |
| 321 | */ |
| 322 | public abstract void setForcedDisplaySize(int displayId, int width, int height); |
| 323 | |
| 324 | /** |
| 325 | * Recover the display size to real display size. |
| 326 | * |
| 327 | * @param displayId The display to recover the display size. |
| 328 | */ |
| 329 | public abstract void clearForcedDisplaySize(int displayId); |
| 330 | |
| 331 | /** |
Svetoslav | 3a5c721 | 2014-10-14 09:54:26 -0700 | [diff] [blame] | 332 | * Adds a window token for a given window type. |
| 333 | * |
| 334 | * @param token The token to add. |
| 335 | * @param type The window type. |
Wale Ogunwale | ac2561e | 2016-11-01 15:43:46 -0700 | [diff] [blame] | 336 | * @param displayId The display to add the token to. |
Svetoslav | 3a5c721 | 2014-10-14 09:54:26 -0700 | [diff] [blame] | 337 | */ |
Wale Ogunwale | ac2561e | 2016-11-01 15:43:46 -0700 | [diff] [blame] | 338 | public abstract void addWindowToken(android.os.IBinder token, int type, int displayId); |
Svetoslav | 3a5c721 | 2014-10-14 09:54:26 -0700 | [diff] [blame] | 339 | |
| 340 | /** |
| 341 | * Removes a window token. |
| 342 | * |
| 343 | * @param token The toke to remove. |
| 344 | * @param removeWindows Whether to also remove the windows associated with the token. |
Wale Ogunwale | ac2561e | 2016-11-01 15:43:46 -0700 | [diff] [blame] | 345 | * @param displayId The display to remove the token from. |
Svetoslav | 3a5c721 | 2014-10-14 09:54:26 -0700 | [diff] [blame] | 346 | */ |
Wale Ogunwale | ac2561e | 2016-11-01 15:43:46 -0700 | [diff] [blame] | 347 | public abstract void removeWindowToken(android.os.IBinder token, boolean removeWindows, |
| 348 | int displayId); |
Jorim Jaggi | 24bec7c | 2015-02-04 12:40:14 +0100 | [diff] [blame] | 349 | |
| 350 | /** |
| 351 | * Registers a listener to be notified about app transition events. |
| 352 | * |
| 353 | * @param listener The listener to register. |
| 354 | */ |
| 355 | public abstract void registerAppTransitionListener(AppTransitionListener listener); |
Seigo Nonaka | 7309b12 | 2015-08-17 18:34:13 -0700 | [diff] [blame] | 356 | |
| 357 | /** |
Adrian Roos | 1c8e3c0 | 2018-11-20 20:07:55 +0100 | [diff] [blame] | 358 | * Reports that the password for the given user has changed. |
| 359 | */ |
| 360 | public abstract void reportPasswordChanged(int userId); |
| 361 | |
| 362 | /** |
lumark | 90120a8 | 2018-08-15 00:33:03 +0800 | [diff] [blame] | 363 | * Retrieves a height of input method window for given display. |
Seigo Nonaka | 7309b12 | 2015-08-17 18:34:13 -0700 | [diff] [blame] | 364 | */ |
lumark | 90120a8 | 2018-08-15 00:33:03 +0800 | [diff] [blame] | 365 | public abstract int getInputMethodWindowVisibleHeight(int displayId); |
Seigo Nonaka | 7309b12 | 2015-08-17 18:34:13 -0700 | [diff] [blame] | 366 | |
| 367 | /** |
Yohei Yukawa | 69e6802 | 2017-02-13 12:04:50 -0800 | [diff] [blame] | 368 | * Notifies WindowManagerService that the current IME window status is being changed. |
| 369 | * |
Yohei Yukawa | 603f4d0 | 2018-09-11 15:04:58 -0700 | [diff] [blame] | 370 | * <p>Only {@link com.android.server.inputmethod.InputMethodManagerService} is the expected and |
| 371 | * tested caller of this method.</p> |
Yohei Yukawa | 69e6802 | 2017-02-13 12:04:50 -0800 | [diff] [blame] | 372 | * |
| 373 | * @param imeToken token to track the active input method. Corresponding IME windows can be |
| 374 | * identified by checking {@link android.view.WindowManager.LayoutParams#token}. |
| 375 | * Note that there is no guarantee that the corresponding window is already |
| 376 | * created |
| 377 | * @param imeWindowVisible whether the active IME thinks that its window should be visible or |
| 378 | * hidden, no matter how WindowManagerService will react / has reacted |
| 379 | * to corresponding API calls. Note that this state is not guaranteed |
| 380 | * to be synchronized with state in WindowManagerService. |
Yohei Yukawa | d6475a6 | 2017-04-17 10:35:27 -0700 | [diff] [blame] | 381 | * @param dismissImeOnBackKeyPressed {@code true} if the software keyboard is shown and the back |
| 382 | * key is expected to dismiss the software keyboard. |
Yohei Yukawa | 69e6802 | 2017-02-13 12:04:50 -0800 | [diff] [blame] | 383 | */ |
Yohei Yukawa | ee2a7ed | 2017-02-15 21:38:57 -0800 | [diff] [blame] | 384 | public abstract void updateInputMethodWindowStatus(@NonNull IBinder imeToken, |
Yohei Yukawa | 99e1f6e | 2018-06-22 17:33:19 -0700 | [diff] [blame] | 385 | boolean imeWindowVisible, boolean dismissImeOnBackKeyPressed); |
| 386 | |
| 387 | /** |
| 388 | * Notifies WindowManagerService that the current IME window status is being changed. |
| 389 | * |
Yohei Yukawa | 603f4d0 | 2018-09-11 15:04:58 -0700 | [diff] [blame] | 390 | * <p>Only {@link com.android.server.inputmethod.InputMethodManagerService} is the expected and |
| 391 | * tested caller of this method.</p> |
Yohei Yukawa | 99e1f6e | 2018-06-22 17:33:19 -0700 | [diff] [blame] | 392 | * |
| 393 | * @param imeToken token to track the active input method. Corresponding IME windows can be |
| 394 | * identified by checking {@link android.view.WindowManager.LayoutParams#token}. |
| 395 | * Note that there is no guarantee that the corresponding window is already |
| 396 | * created |
| 397 | * @param imeTargetWindowToken token to identify the target window that the IME is associated |
| 398 | * with |
| 399 | */ |
| 400 | public abstract void updateInputMethodTargetWindow(@NonNull IBinder imeToken, |
| 401 | @NonNull IBinder imeTargetWindowToken); |
Yohei Yukawa | 69e6802 | 2017-02-13 12:04:50 -0800 | [diff] [blame] | 402 | |
| 403 | /** |
Seigo Nonaka | 7309b12 | 2015-08-17 18:34:13 -0700 | [diff] [blame] | 404 | * Returns true when the hardware keyboard is available. |
| 405 | */ |
| 406 | public abstract boolean isHardKeyboardAvailable(); |
| 407 | |
| 408 | /** |
| 409 | * Sets the callback listener for hardware keyboard status changes. |
| 410 | * |
| 411 | * @param listener The listener to set. |
| 412 | */ |
| 413 | public abstract void setOnHardKeyboardStatusChangeListener( |
| 414 | OnHardKeyboardStatusChangeListener listener); |
Wale Ogunwale | 6e94a9e | 2015-10-07 15:35:49 -0700 | [diff] [blame] | 415 | |
Wale Ogunwale | 44f036f | 2017-09-29 05:09:09 -0700 | [diff] [blame] | 416 | /** Returns true if a stack in the windowing mode is currently visible. */ |
| 417 | public abstract boolean isStackVisible(int windowingMode); |
Jorim Jaggi | 9511b0f | 2016-01-29 19:12:44 -0800 | [diff] [blame] | 418 | |
| 419 | /** |
Phil Weaver | c72faad | 2018-07-24 10:53:01 -0700 | [diff] [blame] | 420 | * Requests the window manager to resend the windows for accessibility. |
Svetoslav Ganov | fd13889 | 2016-07-13 18:20:42 -0700 | [diff] [blame] | 421 | */ |
| 422 | public abstract void computeWindowsForAccessibility(); |
Tarandeep Singh | e1cfcf4 | 2017-07-10 18:50:00 -0700 | [diff] [blame] | 423 | |
| 424 | /** |
| 425 | * Called after virtual display Id is updated by |
| 426 | * {@link com.android.server.vr.Vr2dDisplay} with a specific |
| 427 | * {@param vr2dDisplayId}. |
| 428 | */ |
| 429 | public abstract void setVr2dDisplayId(int vr2dDisplayId); |
Daichi Hirono | 3c6c95e | 2017-09-13 12:23:57 +0900 | [diff] [blame] | 430 | |
| 431 | /** |
| 432 | * Sets callback to DragDropController. |
| 433 | */ |
| 434 | public abstract void registerDragDropControllerCallback(IDragDropCallback callback); |
Eugene Susla | f9a651d | 2017-10-11 12:06:27 -0700 | [diff] [blame] | 435 | |
| 436 | /** |
| 437 | * @see android.view.IWindowManager#lockNow |
| 438 | */ |
| 439 | public abstract void lockNow(); |
Tony Mak | 6f2e97e | 2018-03-26 20:43:06 +0100 | [diff] [blame] | 440 | |
| 441 | /** |
| 442 | * Return the user that owns the given window, {@link android.os.UserHandle#USER_NULL} if |
| 443 | * the window token is not found. |
| 444 | */ |
| 445 | public abstract int getWindowOwnerUserId(IBinder windowToken); |
Chad Brubaker | a6b2d5c | 2018-06-25 12:50:01 -0700 | [diff] [blame] | 446 | |
| 447 | /** |
| 448 | * Returns {@code true} if a Window owned by {@code uid} has focus. |
| 449 | */ |
| 450 | public abstract boolean isUidFocused(int uid); |
Yohei Yukawa | cf93f9a | 2018-08-30 15:58:47 -0700 | [diff] [blame] | 451 | |
| 452 | /** |
Yohei Yukawa | 4052a10f | 2018-10-15 15:35:55 +0800 | [diff] [blame] | 453 | * Checks whether the specified IME client has IME focus or not. |
Yohei Yukawa | 41f89c3 | 2018-09-19 14:30:04 -0700 | [diff] [blame] | 454 | * |
| 455 | * @param uid UID of the process to be queried |
| 456 | * @param pid PID of the process to be queried |
Yohei Yukawa | 4052a10f | 2018-10-15 15:35:55 +0800 | [diff] [blame] | 457 | * @param displayId Display ID reported from the client. Note that this method also verifies |
| 458 | * whether the specified process is allowed to access to this display or not |
| 459 | * @return {@code true} if the IME client specified with {@code uid}, {@code pid}, and |
| 460 | * {@code displayId} has IME focus |
Yohei Yukawa | cf93f9a | 2018-08-30 15:58:47 -0700 | [diff] [blame] | 461 | */ |
Yohei Yukawa | 4052a10f | 2018-10-15 15:35:55 +0800 | [diff] [blame] | 462 | public abstract boolean isInputMethodClientFocus(int uid, int pid, int displayId); |
| 463 | |
| 464 | /** |
| 465 | * Checks whether the given {@code uid} is allowed to use the given {@code displayId} or not. |
| 466 | * |
| 467 | * @param displayId Display ID to be checked |
| 468 | * @param uid UID to be checked. |
| 469 | * @return {@code true} if the given {@code uid} is allowed to use the given {@code displayId} |
| 470 | */ |
| 471 | public abstract boolean isUidAllowedOnDisplay(int displayId, int uid); |
lumark | 90120a8 | 2018-08-15 00:33:03 +0800 | [diff] [blame] | 472 | |
| 473 | /** |
| 474 | * Return the display Id for given window. |
| 475 | */ |
| 476 | public abstract int getDisplayIdForWindow(IBinder windowToken); |
Svetoslav | 8e3feb1 | 2014-02-24 13:46:47 -0800 | [diff] [blame] | 477 | } |