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