Dianne Hackborn | f56e102 | 2011-02-22 10:47:13 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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. |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 15 | */ |
Dianne Hackborn | f56e102 | 2011-02-22 10:47:13 -0800 | [diff] [blame] | 16 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 17 | package com.android.server.wm; |
| 18 | |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 19 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DRAG; |
| 20 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS_LIGHT; |
| 21 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_INPUT; |
| 22 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TASK_POSITIONING; |
| 23 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; |
Filip Gruszczynski | 9cac3b4 | 2015-10-30 14:20:37 -0700 | [diff] [blame] | 24 | |
Dianne Hackborn | 5fe7e2a | 2012-10-04 11:58:16 -0700 | [diff] [blame] | 25 | import android.app.ActivityManagerNative; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 26 | import android.graphics.Rect; |
Wale Ogunwale | e89eeac | 2016-03-12 11:07:58 -0800 | [diff] [blame] | 27 | import android.os.Debug; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 28 | import android.os.RemoteException; |
| 29 | import android.util.Log; |
| 30 | import android.util.Slog; |
Jeff Brown | 83d616a | 2012-09-09 20:33:43 -0700 | [diff] [blame] | 31 | import android.view.Display; |
Jeff Brown | cc4f7db | 2011-08-30 20:34:48 -0700 | [diff] [blame] | 32 | import android.view.InputChannel; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 33 | import android.view.KeyEvent; |
| 34 | import android.view.WindowManager; |
| 35 | |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 36 | import com.android.server.input.InputApplicationHandle; |
| 37 | import com.android.server.input.InputManagerService; |
| 38 | import com.android.server.input.InputWindowHandle; |
| 39 | |
Wale Ogunwale | e89eeac | 2016-03-12 11:07:58 -0800 | [diff] [blame] | 40 | import java.io.PrintWriter; |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 41 | import java.util.Arrays; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 42 | |
Jeff Brown | a9d131c | 2012-09-20 16:48:17 -0700 | [diff] [blame] | 43 | final class InputMonitor implements InputManagerService.WindowManagerCallbacks { |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 44 | private final WindowManagerService mService; |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 45 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 46 | // Current window with input focus for keys and other non-touch events. May be null. |
| 47 | private WindowState mInputFocus; |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 48 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 49 | // When true, prevents input dispatch from proceeding until set to false again. |
| 50 | private boolean mInputDispatchFrozen; |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 51 | |
Wale Ogunwale | e89eeac | 2016-03-12 11:07:58 -0800 | [diff] [blame] | 52 | // The reason the input is currently frozen or null if the input isn't frozen. |
| 53 | private String mInputFreezeReason = null; |
| 54 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 55 | // When true, input dispatch proceeds normally. Otherwise all events are dropped. |
Jeff Brown | c042ee2 | 2012-05-08 13:03:42 -0700 | [diff] [blame] | 56 | // Initially false, so that input does not get dispatched until boot is finished at |
| 57 | // which point the ActivityManager will enable dispatching. |
| 58 | private boolean mInputDispatchEnabled; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 59 | |
| 60 | // When true, need to call updateInputWindowsLw(). |
| 61 | private boolean mUpdateInputWindowsNeeded = true; |
| 62 | |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 63 | // Array of window handles to provide to the input dispatcher. |
| 64 | private InputWindowHandle[] mInputWindowHandles; |
| 65 | private int mInputWindowHandleCount; |
| 66 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 67 | // Set to true when the first input device configuration change notification |
| 68 | // is received to indicate that the input devices are ready. |
| 69 | private final Object mInputDevicesReadyMonitor = new Object(); |
| 70 | private boolean mInputDevicesReady; |
| 71 | |
| 72 | public InputMonitor(WindowManagerService service) { |
| 73 | mService = service; |
| 74 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 75 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 76 | /* Notifies the window manager about a broken input channel. |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 77 | * |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 78 | * Called by the InputManager. |
| 79 | */ |
Craig Mautner | 4cd0c13f | 2013-04-16 15:55:52 -0700 | [diff] [blame] | 80 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 81 | public void notifyInputChannelBroken(InputWindowHandle inputWindowHandle) { |
| 82 | if (inputWindowHandle == null) { |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | synchronized (mService.mWindowMap) { |
| 87 | WindowState windowState = (WindowState) inputWindowHandle.windowState; |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 88 | if (windowState != null) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 89 | Slog.i(TAG_WM, "WINDOW DIED " + windowState); |
Wale Ogunwale | a6ab5c4 | 2015-04-24 09:00:25 -0700 | [diff] [blame] | 90 | mService.removeWindowLocked(windowState); |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 91 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 92 | } |
| 93 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 94 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 95 | /* Notifies the window manager about an application that is not responding. |
| 96 | * Returns a new timeout to continue waiting in nanoseconds, or 0 to abort dispatch. |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 97 | * |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 98 | * Called by the InputManager. |
| 99 | */ |
Craig Mautner | 4cd0c13f | 2013-04-16 15:55:52 -0700 | [diff] [blame] | 100 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 101 | public long notifyANR(InputApplicationHandle inputApplicationHandle, |
Jeff Brown | bd181bb | 2013-09-10 16:44:24 -0700 | [diff] [blame] | 102 | InputWindowHandle inputWindowHandle, String reason) { |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 103 | AppWindowToken appWindowToken = null; |
Dianne Hackborn | 5fe7e2a | 2012-10-04 11:58:16 -0700 | [diff] [blame] | 104 | WindowState windowState = null; |
| 105 | boolean aboveSystem = false; |
Jeff Brown | ee17241 | 2012-06-18 12:58:03 -0700 | [diff] [blame] | 106 | synchronized (mService.mWindowMap) { |
Jeff Brown | ee17241 | 2012-06-18 12:58:03 -0700 | [diff] [blame] | 107 | if (inputWindowHandle != null) { |
| 108 | windowState = (WindowState) inputWindowHandle.windowState; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 109 | if (windowState != null) { |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 110 | appWindowToken = windowState.mAppToken; |
| 111 | } |
| 112 | } |
Jeff Brown | ee17241 | 2012-06-18 12:58:03 -0700 | [diff] [blame] | 113 | if (appWindowToken == null && inputApplicationHandle != null) { |
| 114 | appWindowToken = (AppWindowToken)inputApplicationHandle.appWindowToken; |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 115 | } |
Jeff Brown | ee17241 | 2012-06-18 12:58:03 -0700 | [diff] [blame] | 116 | |
| 117 | if (windowState != null) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 118 | Slog.i(TAG_WM, "Input event dispatching timed out " |
Jeff Brown | bd181bb | 2013-09-10 16:44:24 -0700 | [diff] [blame] | 119 | + "sending to " + windowState.mAttrs.getTitle() |
| 120 | + ". Reason: " + reason); |
Dianne Hackborn | 5fe7e2a | 2012-10-04 11:58:16 -0700 | [diff] [blame] | 121 | // Figure out whether this window is layered above system windows. |
| 122 | // We need to do this here to help the activity manager know how to |
| 123 | // layer its ANR dialog. |
| 124 | int systemAlertLayer = mService.mPolicy.windowTypeToLayerLw( |
| 125 | WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); |
| 126 | aboveSystem = windowState.mBaseLayer > systemAlertLayer; |
Jeff Brown | ee17241 | 2012-06-18 12:58:03 -0700 | [diff] [blame] | 127 | } else if (appWindowToken != null) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 128 | Slog.i(TAG_WM, "Input event dispatching timed out " |
Jeff Brown | bd181bb | 2013-09-10 16:44:24 -0700 | [diff] [blame] | 129 | + "sending to application " + appWindowToken.stringName |
| 130 | + ". Reason: " + reason); |
Jeff Brown | ee17241 | 2012-06-18 12:58:03 -0700 | [diff] [blame] | 131 | } else { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 132 | Slog.i(TAG_WM, "Input event dispatching timed out " |
Jeff Brown | bd181bb | 2013-09-10 16:44:24 -0700 | [diff] [blame] | 133 | + ". Reason: " + reason); |
Jeff Brown | ee17241 | 2012-06-18 12:58:03 -0700 | [diff] [blame] | 134 | } |
| 135 | |
Jeff Brown | bd181bb | 2013-09-10 16:44:24 -0700 | [diff] [blame] | 136 | mService.saveANRStateLocked(appWindowToken, windowState, reason); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | if (appWindowToken != null && appWindowToken.appToken != null) { |
| 140 | try { |
| 141 | // Notify the activity manager about the timeout and let it decide whether |
| 142 | // to abort dispatching or keep waiting. |
Jeff Brown | bd181bb | 2013-09-10 16:44:24 -0700 | [diff] [blame] | 143 | boolean abort = appWindowToken.appToken.keyDispatchingTimedOut(reason); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 144 | if (! abort) { |
| 145 | // The activity manager declined to abort dispatching. |
| 146 | // Wait a bit longer and timeout again later. |
| 147 | return appWindowToken.inputDispatchingTimeoutNanos; |
| 148 | } |
| 149 | } catch (RemoteException ex) { |
| 150 | } |
Dianne Hackborn | 5fe7e2a | 2012-10-04 11:58:16 -0700 | [diff] [blame] | 151 | } else if (windowState != null) { |
| 152 | try { |
| 153 | // Notify the activity manager about the timeout and let it decide whether |
| 154 | // to abort dispatching or keep waiting. |
| 155 | long timeout = ActivityManagerNative.getDefault().inputDispatchingTimedOut( |
Jeff Brown | bd181bb | 2013-09-10 16:44:24 -0700 | [diff] [blame] | 156 | windowState.mSession.mPid, aboveSystem, reason); |
Dianne Hackborn | 5fe7e2a | 2012-10-04 11:58:16 -0700 | [diff] [blame] | 157 | if (timeout >= 0) { |
| 158 | // The activity manager declined to abort dispatching. |
| 159 | // Wait a bit longer and timeout again later. |
baik.han | def340d | 2015-04-15 10:21:05 +0900 | [diff] [blame] | 160 | return timeout * 1000000L; // nanoseconds |
Dianne Hackborn | 5fe7e2a | 2012-10-04 11:58:16 -0700 | [diff] [blame] | 161 | } |
| 162 | } catch (RemoteException ex) { |
| 163 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 164 | } |
| 165 | return 0; // abort dispatching |
| 166 | } |
| 167 | |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 168 | private void addInputWindowHandleLw(final InputWindowHandle windowHandle) { |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 169 | if (mInputWindowHandles == null) { |
| 170 | mInputWindowHandles = new InputWindowHandle[16]; |
| 171 | } |
| 172 | if (mInputWindowHandleCount >= mInputWindowHandles.length) { |
| 173 | mInputWindowHandles = Arrays.copyOf(mInputWindowHandles, |
| 174 | mInputWindowHandleCount * 2); |
| 175 | } |
| 176 | mInputWindowHandles[mInputWindowHandleCount++] = windowHandle; |
| 177 | } |
| 178 | |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 179 | private void addInputWindowHandleLw(final InputWindowHandle inputWindowHandle, |
Craig Mautner | c08eab8 | 2014-11-11 09:03:59 -0800 | [diff] [blame] | 180 | final WindowState child, int flags, final int type, final boolean isVisible, |
Wale Ogunwale | 053c8e4 | 2015-11-16 14:27:21 -0800 | [diff] [blame] | 181 | final boolean hasFocus, final boolean hasWallpaper) { |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 182 | // Add a window to our list of input windows. |
| 183 | inputWindowHandle.name = child.toString(); |
Wale Ogunwale | 053c8e4 | 2015-11-16 14:27:21 -0800 | [diff] [blame] | 184 | flags = child.getTouchableRegion(inputWindowHandle.touchableRegion, flags); |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 185 | inputWindowHandle.layoutParamsFlags = flags; |
| 186 | inputWindowHandle.layoutParamsType = type; |
| 187 | inputWindowHandle.dispatchingTimeoutNanos = child.getInputDispatchingTimeoutNanos(); |
| 188 | inputWindowHandle.visible = isVisible; |
| 189 | inputWindowHandle.canReceiveKeys = child.canReceiveKeys(); |
| 190 | inputWindowHandle.hasFocus = hasFocus; |
| 191 | inputWindowHandle.hasWallpaper = hasWallpaper; |
| 192 | inputWindowHandle.paused = child.mAppToken != null ? child.mAppToken.paused : false; |
| 193 | inputWindowHandle.layer = child.mLayer; |
| 194 | inputWindowHandle.ownerPid = child.mSession.mPid; |
| 195 | inputWindowHandle.ownerUid = child.mSession.mUid; |
| 196 | inputWindowHandle.inputFeatures = child.mAttrs.inputFeatures; |
| 197 | |
| 198 | final Rect frame = child.mFrame; |
| 199 | inputWindowHandle.frameLeft = frame.left; |
| 200 | inputWindowHandle.frameTop = frame.top; |
| 201 | inputWindowHandle.frameRight = frame.right; |
| 202 | inputWindowHandle.frameBottom = frame.bottom; |
| 203 | |
Chong Zhang | b15758a | 2015-11-17 12:12:03 -0800 | [diff] [blame] | 204 | if (child.isDockedInEffect()) { |
| 205 | // Adjust to account for non-resizeable tasks that's scrolled |
| 206 | inputWindowHandle.frameLeft += child.mXOffset; |
| 207 | inputWindowHandle.frameTop += child.mYOffset; |
| 208 | inputWindowHandle.frameRight += child.mXOffset; |
| 209 | inputWindowHandle.frameBottom += child.mYOffset; |
| 210 | } |
| 211 | |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 212 | if (child.mGlobalScale != 1) { |
| 213 | // If we are scaling the window, input coordinates need |
| 214 | // to be inversely scaled to map from what is on screen |
| 215 | // to what is actually being touched in the UI. |
| 216 | inputWindowHandle.scaleFactor = 1.0f/child.mGlobalScale; |
| 217 | } else { |
| 218 | inputWindowHandle.scaleFactor = 1; |
| 219 | } |
| 220 | |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 221 | if (DEBUG_INPUT) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 222 | Slog.d(TAG_WM, "addInputWindowHandle: " |
Chong Zhang | b15758a | 2015-11-17 12:12:03 -0800 | [diff] [blame] | 223 | + child + ", " + inputWindowHandle); |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 224 | } |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 225 | addInputWindowHandleLw(inputWindowHandle); |
| 226 | } |
| 227 | |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 228 | private void clearInputWindowHandlesLw() { |
| 229 | while (mInputWindowHandleCount != 0) { |
| 230 | mInputWindowHandles[--mInputWindowHandleCount] = null; |
| 231 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | public void setUpdateInputWindowsNeededLw() { |
| 235 | mUpdateInputWindowsNeeded = true; |
| 236 | } |
| 237 | |
| 238 | /* Updates the cached window information provided to the input dispatcher. */ |
| 239 | public void updateInputWindowsLw(boolean force) { |
| 240 | if (!force && !mUpdateInputWindowsNeeded) { |
| 241 | return; |
| 242 | } |
| 243 | mUpdateInputWindowsNeeded = false; |
| 244 | |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 245 | if (false) Slog.d(TAG_WM, ">>>>>> ENTERED updateInputWindowsLw"); |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 246 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 247 | // Populate the input window list with information about all of the windows that |
| 248 | // could potentially receive input. |
| 249 | // As an optimization, we could try to prune the list of windows but this turns |
| 250 | // out to be difficult because only the native code knows for sure which window |
| 251 | // currently has touch focus. |
Filip Gruszczynski | b8c0694 | 2014-12-04 15:02:18 -0800 | [diff] [blame] | 252 | boolean disableWallpaperTouchEvents = false; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 253 | |
| 254 | // If there's a drag in flight, provide a pseudowindow to catch drag input |
| 255 | final boolean inDrag = (mService.mDragState != null); |
| 256 | if (inDrag) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 257 | if (DEBUG_DRAG) { |
| 258 | Log.d(TAG_WM, "Inserting drag window"); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 259 | } |
Jeff Brown | cc4f7db | 2011-08-30 20:34:48 -0700 | [diff] [blame] | 260 | final InputWindowHandle dragWindowHandle = mService.mDragState.mDragWindowHandle; |
| 261 | if (dragWindowHandle != null) { |
| 262 | addInputWindowHandleLw(dragWindowHandle); |
| 263 | } else { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 264 | Slog.w(TAG_WM, "Drag is in progress but there is no " |
Jeff Brown | cc4f7db | 2011-08-30 20:34:48 -0700 | [diff] [blame] | 265 | + "drag window handle."); |
| 266 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 267 | } |
| 268 | |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 269 | final boolean inPositioning = (mService.mTaskPositioner != null); |
| 270 | if (inPositioning) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 271 | if (DEBUG_TASK_POSITIONING) { |
| 272 | Log.d(TAG_WM, "Inserting window handle for repositioning"); |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 273 | } |
| 274 | final InputWindowHandle dragWindowHandle = mService.mTaskPositioner.mDragWindowHandle; |
| 275 | if (dragWindowHandle != null) { |
| 276 | addInputWindowHandleLw(dragWindowHandle); |
| 277 | } else { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 278 | Slog.e(TAG_WM, |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 279 | "Repositioning is in progress but there is no drag window handle."); |
| 280 | } |
| 281 | } |
| 282 | |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 283 | boolean addInputConsumerHandle = mService.mInputConsumer != null; |
Dianne Hackborn | df89e65 | 2011-10-06 22:35:11 -0700 | [diff] [blame] | 284 | |
Vladislav Kaznacheev | 0d50d86 | 2016-03-29 15:43:28 -0700 | [diff] [blame] | 285 | boolean addWallpaperInputConsumerHandle = mService.mWallpaperInputConsumer != null; |
| 286 | |
Jeff Brown | 83d616a | 2012-09-09 20:33:43 -0700 | [diff] [blame] | 287 | // Add all windows on the default display. |
Craig Mautner | f892415 | 2013-07-16 09:10:55 -0700 | [diff] [blame] | 288 | final int numDisplays = mService.mDisplayContents.size(); |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 289 | final WallpaperController wallpaperController = mService.mWallpaperControllerLocked; |
Craig Mautner | f892415 | 2013-07-16 09:10:55 -0700 | [diff] [blame] | 290 | for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) { |
Filip Gruszczynski | 3ddc5d6 | 2015-09-23 15:01:30 -0700 | [diff] [blame] | 291 | final DisplayContent displayContent = mService.mDisplayContents.valueAt(displayNdx); |
| 292 | final WindowList windows = displayContent.getWindowList(); |
Craig Mautner | f892415 | 2013-07-16 09:10:55 -0700 | [diff] [blame] | 293 | for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) { |
| 294 | final WindowState child = windows.get(winNdx); |
| 295 | final InputChannel inputChannel = child.mInputChannel; |
| 296 | final InputWindowHandle inputWindowHandle = child.mInputWindowHandle; |
Jorim Jaggi | b72c9ad | 2016-04-11 18:27:58 -0700 | [diff] [blame^] | 297 | if (inputChannel == null || inputWindowHandle == null || child.mRemoved |
| 298 | || child.isAdjustedForMinimizedDock()) { |
Craig Mautner | f892415 | 2013-07-16 09:10:55 -0700 | [diff] [blame] | 299 | // Skip this window because it cannot possibly receive input. |
| 300 | continue; |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 301 | } |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 302 | if (addInputConsumerHandle |
| 303 | && inputWindowHandle.layer <= mService.mInputConsumer.mWindowHandle.layer) { |
| 304 | addInputWindowHandleLw(mService.mInputConsumer.mWindowHandle); |
| 305 | addInputConsumerHandle = false; |
| 306 | } |
Dianne Hackborn | e2515ee | 2011-04-27 18:52:56 -0400 | [diff] [blame] | 307 | |
Vladislav Kaznacheev | 0d50d86 | 2016-03-29 15:43:28 -0700 | [diff] [blame] | 308 | if (addWallpaperInputConsumerHandle) { |
| 309 | if (child.mAttrs.type == WindowManager.LayoutParams.TYPE_WALLPAPER) { |
| 310 | // Add the wallpaper input consumer above the first wallpaper window. |
| 311 | addInputWindowHandleLw(mService.mWallpaperInputConsumer.mWindowHandle); |
| 312 | addWallpaperInputConsumerHandle = false; |
| 313 | } |
| 314 | } |
| 315 | |
Craig Mautner | f892415 | 2013-07-16 09:10:55 -0700 | [diff] [blame] | 316 | final int flags = child.mAttrs.flags; |
Adam Lesinski | 95c4297 | 2013-10-02 10:13:27 -0700 | [diff] [blame] | 317 | final int privateFlags = child.mAttrs.privateFlags; |
Craig Mautner | f892415 | 2013-07-16 09:10:55 -0700 | [diff] [blame] | 318 | final int type = child.mAttrs.type; |
| 319 | |
| 320 | final boolean hasFocus = (child == mInputFocus); |
| 321 | final boolean isVisible = child.isVisibleLw(); |
Filip Gruszczynski | b8c0694 | 2014-12-04 15:02:18 -0800 | [diff] [blame] | 322 | if ((privateFlags |
| 323 | & WindowManager.LayoutParams.PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS) |
| 324 | != 0) { |
| 325 | disableWallpaperTouchEvents = true; |
| 326 | } |
Wale Ogunwale | e8069dc | 2015-08-18 09:52:01 -0700 | [diff] [blame] | 327 | final boolean hasWallpaper = wallpaperController.isWallpaperTarget(child) |
Filip Gruszczynski | b8c0694 | 2014-12-04 15:02:18 -0800 | [diff] [blame] | 328 | && (privateFlags & WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD) == 0 |
| 329 | && !disableWallpaperTouchEvents; |
Craig Mautner | f892415 | 2013-07-16 09:10:55 -0700 | [diff] [blame] | 330 | final boolean onDefaultDisplay = (child.getDisplayId() == Display.DEFAULT_DISPLAY); |
| 331 | |
| 332 | // If there's a drag in progress and 'child' is a potential drop target, |
| 333 | // make sure it's been told about the drag |
| 334 | if (inDrag && isVisible && onDefaultDisplay) { |
| 335 | mService.mDragState.sendDragStartedIfNeededLw(child); |
| 336 | } |
| 337 | |
Wale Ogunwale | 053c8e4 | 2015-11-16 14:27:21 -0800 | [diff] [blame] | 338 | addInputWindowHandleLw( |
| 339 | inputWindowHandle, child, flags, type, isVisible, hasFocus, hasWallpaper); |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 340 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 341 | } |
| 342 | |
Vladislav Kaznacheev | 0d50d86 | 2016-03-29 15:43:28 -0700 | [diff] [blame] | 343 | if (addWallpaperInputConsumerHandle) { |
| 344 | // No wallpaper found, add the wallpaper input consumer at the end. |
| 345 | addInputWindowHandleLw(mService.mWallpaperInputConsumer.mWindowHandle); |
| 346 | } |
| 347 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 348 | // Send windows to native code. |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 349 | mService.mInputManager.setInputWindows(mInputWindowHandles); |
| 350 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 351 | // Clear the list in preparation for the next round. |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 352 | clearInputWindowHandlesLw(); |
| 353 | |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 354 | if (false) Slog.d(TAG_WM, "<<<<<<< EXITED updateInputWindowsLw"); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 355 | } |
| 356 | |
| 357 | /* Notifies that the input device configuration has changed. */ |
Jeff Brown | 0b31d81 | 2013-08-22 19:41:29 -0700 | [diff] [blame] | 358 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 359 | public void notifyConfigurationChanged() { |
| 360 | mService.sendNewConfiguration(); |
| 361 | |
| 362 | synchronized (mInputDevicesReadyMonitor) { |
| 363 | if (!mInputDevicesReady) { |
| 364 | mInputDevicesReady = true; |
| 365 | mInputDevicesReadyMonitor.notifyAll(); |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | /* Waits until the built-in input devices have been configured. */ |
| 371 | public boolean waitForInputDevicesReady(long timeoutMillis) { |
| 372 | synchronized (mInputDevicesReadyMonitor) { |
| 373 | if (!mInputDevicesReady) { |
| 374 | try { |
| 375 | mInputDevicesReadyMonitor.wait(timeoutMillis); |
| 376 | } catch (InterruptedException ex) { |
| 377 | } |
| 378 | } |
| 379 | return mInputDevicesReady; |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | /* Notifies that the lid switch changed state. */ |
Jeff Brown | 0b31d81 | 2013-08-22 19:41:29 -0700 | [diff] [blame] | 384 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 385 | public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) { |
| 386 | mService.mPolicy.notifyLidSwitchChanged(whenNanos, lidOpen); |
| 387 | } |
Craig Mautner | 5845812 | 2013-09-14 14:59:50 -0700 | [diff] [blame] | 388 | |
Michael Wright | 3818c92 | 2014-09-02 13:59:07 -0700 | [diff] [blame] | 389 | /* Notifies that the camera lens cover state has changed. */ |
| 390 | @Override |
| 391 | public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered) { |
| 392 | mService.mPolicy.notifyCameraLensCoverSwitchChanged(whenNanos, lensCovered); |
| 393 | } |
| 394 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 395 | /* Provides an opportunity for the window manager policy to intercept early key |
| 396 | * processing as soon as the key has been read from the device. */ |
Jeff Brown | 0b31d81 | 2013-08-22 19:41:29 -0700 | [diff] [blame] | 397 | @Override |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 398 | public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags) { |
| 399 | return mService.mPolicy.interceptKeyBeforeQueueing(event, policyFlags); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 400 | } |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 401 | |
Michael Wright | 70af00a | 2014-09-03 19:30:20 -0700 | [diff] [blame] | 402 | /* Provides an opportunity for the window manager policy to intercept early motion event |
| 403 | * processing when the device is in a non-interactive state since these events are normally |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 404 | * dropped. */ |
Jeff Brown | 0b31d81 | 2013-08-22 19:41:29 -0700 | [diff] [blame] | 405 | @Override |
Michael Wright | 70af00a | 2014-09-03 19:30:20 -0700 | [diff] [blame] | 406 | public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) { |
| 407 | return mService.mPolicy.interceptMotionBeforeQueueingNonInteractive( |
| 408 | whenNanos, policyFlags); |
Jeff Brown | 56194eb | 2011-03-02 19:23:13 -0800 | [diff] [blame] | 409 | } |
| 410 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 411 | /* Provides an opportunity for the window manager policy to process a key before |
| 412 | * ordinary dispatch. */ |
Jeff Brown | 0b31d81 | 2013-08-22 19:41:29 -0700 | [diff] [blame] | 413 | @Override |
Jeff Brown | 905805a | 2011-10-12 13:57:59 -0700 | [diff] [blame] | 414 | public long interceptKeyBeforeDispatching( |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 415 | InputWindowHandle focus, KeyEvent event, int policyFlags) { |
| 416 | WindowState windowState = focus != null ? (WindowState) focus.windowState : null; |
| 417 | return mService.mPolicy.interceptKeyBeforeDispatching(windowState, event, policyFlags); |
| 418 | } |
Craig Mautner | 5845812 | 2013-09-14 14:59:50 -0700 | [diff] [blame] | 419 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 420 | /* Provides an opportunity for the window manager policy to process a key that |
| 421 | * the application did not handle. */ |
Jeff Brown | 0b31d81 | 2013-08-22 19:41:29 -0700 | [diff] [blame] | 422 | @Override |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 423 | public KeyEvent dispatchUnhandledKey( |
| 424 | InputWindowHandle focus, KeyEvent event, int policyFlags) { |
| 425 | WindowState windowState = focus != null ? (WindowState) focus.windowState : null; |
| 426 | return mService.mPolicy.dispatchUnhandledKey(windowState, event, policyFlags); |
| 427 | } |
Jeff Brown | 4532e61 | 2012-04-05 14:27:12 -0700 | [diff] [blame] | 428 | |
| 429 | /* Callback to get pointer layer. */ |
Jeff Brown | 0b31d81 | 2013-08-22 19:41:29 -0700 | [diff] [blame] | 430 | @Override |
Jeff Brown | 4532e61 | 2012-04-05 14:27:12 -0700 | [diff] [blame] | 431 | public int getPointerLayer() { |
| 432 | return mService.mPolicy.windowTypeToLayerLw(WindowManager.LayoutParams.TYPE_POINTER) |
| 433 | * WindowManagerService.TYPE_LAYER_MULTIPLIER |
| 434 | + WindowManagerService.TYPE_LAYER_OFFSET; |
| 435 | } |
| 436 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 437 | /* Called when the current input focus changes. |
| 438 | * Layer assignment is assumed to be complete by the time this is called. |
| 439 | */ |
| 440 | public void setInputFocusLw(WindowState newWindow, boolean updateInputWindows) { |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 441 | if (DEBUG_FOCUS_LIGHT || DEBUG_INPUT) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 442 | Slog.d(TAG_WM, "Input focus has changed to " + newWindow); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 443 | } |
| 444 | |
| 445 | if (newWindow != mInputFocus) { |
| 446 | if (newWindow != null && newWindow.canReceiveKeys()) { |
| 447 | // Displaying a window implicitly causes dispatching to be unpaused. |
| 448 | // This is to protect against bugs if someone pauses dispatching but |
| 449 | // forgets to resume. |
| 450 | newWindow.mToken.paused = false; |
| 451 | } |
| 452 | |
| 453 | mInputFocus = newWindow; |
| 454 | setUpdateInputWindowsNeededLw(); |
| 455 | |
| 456 | if (updateInputWindows) { |
| 457 | updateInputWindowsLw(false /*force*/); |
| 458 | } |
| 459 | } |
| 460 | } |
Craig Mautner | 5845812 | 2013-09-14 14:59:50 -0700 | [diff] [blame] | 461 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 462 | public void setFocusedAppLw(AppWindowToken newApp) { |
| 463 | // Focused app has changed. |
| 464 | if (newApp == null) { |
| 465 | mService.mInputManager.setFocusedApplication(null); |
| 466 | } else { |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 467 | final InputApplicationHandle handle = newApp.mInputApplicationHandle; |
| 468 | handle.name = newApp.toString(); |
| 469 | handle.dispatchingTimeoutNanos = newApp.inputDispatchingTimeoutNanos; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 470 | |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 471 | mService.mInputManager.setFocusedApplication(handle); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 472 | } |
| 473 | } |
Craig Mautner | 5845812 | 2013-09-14 14:59:50 -0700 | [diff] [blame] | 474 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 475 | public void pauseDispatchingLw(WindowToken window) { |
| 476 | if (! window.paused) { |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 477 | if (DEBUG_INPUT) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 478 | Slog.v(TAG_WM, "Pausing WindowToken " + window); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 479 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 480 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 481 | window.paused = true; |
| 482 | updateInputWindowsLw(true /*force*/); |
| 483 | } |
| 484 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 485 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 486 | public void resumeDispatchingLw(WindowToken window) { |
| 487 | if (window.paused) { |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 488 | if (DEBUG_INPUT) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 489 | Slog.v(TAG_WM, "Resuming WindowToken " + window); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 490 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 491 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 492 | window.paused = false; |
| 493 | updateInputWindowsLw(true /*force*/); |
| 494 | } |
| 495 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 496 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 497 | public void freezeInputDispatchingLw() { |
Wale Ogunwale | e89eeac | 2016-03-12 11:07:58 -0800 | [diff] [blame] | 498 | if (!mInputDispatchFrozen) { |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 499 | if (DEBUG_INPUT) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 500 | Slog.v(TAG_WM, "Freezing input dispatching"); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 501 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 502 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 503 | mInputDispatchFrozen = true; |
Wale Ogunwale | e89eeac | 2016-03-12 11:07:58 -0800 | [diff] [blame] | 504 | |
| 505 | if (DEBUG_INPUT || true) { |
| 506 | mInputFreezeReason = Debug.getCallers(6); |
| 507 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 508 | updateInputDispatchModeLw(); |
| 509 | } |
| 510 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 511 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 512 | public void thawInputDispatchingLw() { |
| 513 | if (mInputDispatchFrozen) { |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 514 | if (DEBUG_INPUT) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 515 | Slog.v(TAG_WM, "Thawing input dispatching"); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 516 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 517 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 518 | mInputDispatchFrozen = false; |
Wale Ogunwale | e89eeac | 2016-03-12 11:07:58 -0800 | [diff] [blame] | 519 | mInputFreezeReason = null; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 520 | updateInputDispatchModeLw(); |
| 521 | } |
| 522 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 523 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 524 | public void setEventDispatchingLw(boolean enabled) { |
| 525 | if (mInputDispatchEnabled != enabled) { |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 526 | if (DEBUG_INPUT) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 527 | Slog.v(TAG_WM, "Setting event dispatching to " + enabled); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 528 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 529 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 530 | mInputDispatchEnabled = enabled; |
| 531 | updateInputDispatchModeLw(); |
| 532 | } |
| 533 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 534 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 535 | private void updateInputDispatchModeLw() { |
| 536 | mService.mInputManager.setInputDispatchMode(mInputDispatchEnabled, mInputDispatchFrozen); |
| 537 | } |
Wale Ogunwale | e89eeac | 2016-03-12 11:07:58 -0800 | [diff] [blame] | 538 | |
| 539 | void dump(PrintWriter pw, String prefix) { |
| 540 | if (mInputFreezeReason != null) { |
| 541 | pw.println(prefix + "mInputFreezeReason=" + mInputFreezeReason); |
| 542 | } |
| 543 | } |
Jeff Brown | ea42655 | 2011-07-18 16:53:48 -0700 | [diff] [blame] | 544 | } |