blob: cacc72304e1e1e8b274f38845e9f92800121461f [file] [log] [blame]
Dianne Hackbornf56e1022011-02-22 10:47:13 -08001/*
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 Hackborn6e1eb762011-02-17 16:07:28 -080015 */
Dianne Hackbornf56e1022011-02-22 10:47:13 -080016
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080017package com.android.server.wm;
18
Jeff Brown4532e612012-04-05 14:27:12 -070019import com.android.server.input.InputManagerService;
20import com.android.server.input.InputApplicationHandle;
21import com.android.server.input.InputWindowHandle;
Jeff Brown83d616a2012-09-09 20:33:43 -070022import com.android.server.wm.WindowManagerService.AllWindowsIterator;
Jeff Brown4532e612012-04-05 14:27:12 -070023
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -070024import android.app.ActivityManagerNative;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080025import android.graphics.Rect;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080026import android.os.RemoteException;
27import android.util.Log;
28import android.util.Slog;
Jeff Brown83d616a2012-09-09 20:33:43 -070029import android.view.Display;
Jeff Browncc4f7db2011-08-30 20:34:48 -070030import android.view.InputChannel;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080031import android.view.KeyEvent;
32import android.view.WindowManager;
33
Jeff Brown9302c872011-07-13 22:51:29 -070034import java.util.Arrays;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080035
Jeff Browna9d131c2012-09-20 16:48:17 -070036final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080037 private final WindowManagerService mService;
38
39 // Current window with input focus for keys and other non-touch events. May be null.
40 private WindowState mInputFocus;
41
42 // When true, prevents input dispatch from proceeding until set to false again.
43 private boolean mInputDispatchFrozen;
44
45 // When true, input dispatch proceeds normally. Otherwise all events are dropped.
Jeff Brownc042ee22012-05-08 13:03:42 -070046 // Initially false, so that input does not get dispatched until boot is finished at
47 // which point the ActivityManager will enable dispatching.
48 private boolean mInputDispatchEnabled;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080049
50 // When true, need to call updateInputWindowsLw().
51 private boolean mUpdateInputWindowsNeeded = true;
52
Jeff Brown9302c872011-07-13 22:51:29 -070053 // Array of window handles to provide to the input dispatcher.
54 private InputWindowHandle[] mInputWindowHandles;
55 private int mInputWindowHandleCount;
56
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080057 // Set to true when the first input device configuration change notification
58 // is received to indicate that the input devices are ready.
59 private final Object mInputDevicesReadyMonitor = new Object();
60 private boolean mInputDevicesReady;
61
62 public InputMonitor(WindowManagerService service) {
63 mService = service;
64 }
65
66 /* Notifies the window manager about a broken input channel.
67 *
68 * Called by the InputManager.
69 */
Craig Mautner4cd0c13f2013-04-16 15:55:52 -070070 @Override
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080071 public void notifyInputChannelBroken(InputWindowHandle inputWindowHandle) {
72 if (inputWindowHandle == null) {
73 return;
74 }
75
76 synchronized (mService.mWindowMap) {
77 WindowState windowState = (WindowState) inputWindowHandle.windowState;
Jeff Brown9302c872011-07-13 22:51:29 -070078 if (windowState != null) {
79 Slog.i(WindowManagerService.TAG, "WINDOW DIED " + windowState);
80 mService.removeWindowLocked(windowState.mSession, windowState);
81 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080082 }
83 }
84
85 /* Notifies the window manager about an application that is not responding.
86 * Returns a new timeout to continue waiting in nanoseconds, or 0 to abort dispatch.
87 *
88 * Called by the InputManager.
89 */
Craig Mautner4cd0c13f2013-04-16 15:55:52 -070090 @Override
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080091 public long notifyANR(InputApplicationHandle inputApplicationHandle,
92 InputWindowHandle inputWindowHandle) {
93 AppWindowToken appWindowToken = null;
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -070094 WindowState windowState = null;
95 boolean aboveSystem = false;
Jeff Brownee172412012-06-18 12:58:03 -070096 synchronized (mService.mWindowMap) {
Jeff Brownee172412012-06-18 12:58:03 -070097 if (inputWindowHandle != null) {
98 windowState = (WindowState) inputWindowHandle.windowState;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080099 if (windowState != null) {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800100 appWindowToken = windowState.mAppToken;
101 }
102 }
Jeff Brownee172412012-06-18 12:58:03 -0700103 if (appWindowToken == null && inputApplicationHandle != null) {
104 appWindowToken = (AppWindowToken)inputApplicationHandle.appWindowToken;
Jeff Brown9302c872011-07-13 22:51:29 -0700105 }
Jeff Brownee172412012-06-18 12:58:03 -0700106
107 if (windowState != null) {
108 Slog.i(WindowManagerService.TAG, "Input event dispatching timed out "
109 + "sending to " + windowState.mAttrs.getTitle());
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -0700110 // Figure out whether this window is layered above system windows.
111 // We need to do this here to help the activity manager know how to
112 // layer its ANR dialog.
113 int systemAlertLayer = mService.mPolicy.windowTypeToLayerLw(
114 WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
115 aboveSystem = windowState.mBaseLayer > systemAlertLayer;
Jeff Brownee172412012-06-18 12:58:03 -0700116 } else if (appWindowToken != null) {
117 Slog.i(WindowManagerService.TAG, "Input event dispatching timed out "
118 + "sending to application " + appWindowToken.stringName);
119 } else {
120 Slog.i(WindowManagerService.TAG, "Input event dispatching timed out.");
121 }
122
123 mService.saveANRStateLocked(appWindowToken, windowState);
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800124 }
125
126 if (appWindowToken != null && appWindowToken.appToken != null) {
127 try {
128 // Notify the activity manager about the timeout and let it decide whether
129 // to abort dispatching or keep waiting.
130 boolean abort = appWindowToken.appToken.keyDispatchingTimedOut();
131 if (! abort) {
132 // The activity manager declined to abort dispatching.
133 // Wait a bit longer and timeout again later.
134 return appWindowToken.inputDispatchingTimeoutNanos;
135 }
136 } catch (RemoteException ex) {
137 }
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -0700138 } else if (windowState != null) {
139 try {
140 // Notify the activity manager about the timeout and let it decide whether
141 // to abort dispatching or keep waiting.
142 long timeout = ActivityManagerNative.getDefault().inputDispatchingTimedOut(
143 windowState.mSession.mPid, aboveSystem);
144 if (timeout >= 0) {
145 // The activity manager declined to abort dispatching.
146 // Wait a bit longer and timeout again later.
147 return timeout;
148 }
149 } catch (RemoteException ex) {
150 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800151 }
152 return 0; // abort dispatching
153 }
154
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700155 private void addInputWindowHandleLw(final InputWindowHandle windowHandle) {
Jeff Brown9302c872011-07-13 22:51:29 -0700156 if (mInputWindowHandles == null) {
157 mInputWindowHandles = new InputWindowHandle[16];
158 }
159 if (mInputWindowHandleCount >= mInputWindowHandles.length) {
160 mInputWindowHandles = Arrays.copyOf(mInputWindowHandles,
161 mInputWindowHandleCount * 2);
162 }
163 mInputWindowHandles[mInputWindowHandleCount++] = windowHandle;
164 }
165
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700166 private void addInputWindowHandleLw(final InputWindowHandle inputWindowHandle,
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700167 final WindowState child, int flags, final int type,
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700168 final boolean isVisible, final boolean hasFocus, final boolean hasWallpaper) {
169 // Add a window to our list of input windows.
170 inputWindowHandle.name = child.toString();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700171 final boolean modal = (flags & (WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
172 | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE)) == 0;
173 if (modal && child.mAppToken != null) {
174 // Limit the outer touch to the activity stack region.
175 flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
176 inputWindowHandle.touchableRegion.set(child.getStackBounds());
177 } else {
178 // Not modal or full screen modal
179 child.getTouchableRegion(inputWindowHandle.touchableRegion);
180 }
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700181 inputWindowHandle.layoutParamsFlags = flags;
182 inputWindowHandle.layoutParamsType = type;
183 inputWindowHandle.dispatchingTimeoutNanos = child.getInputDispatchingTimeoutNanos();
184 inputWindowHandle.visible = isVisible;
185 inputWindowHandle.canReceiveKeys = child.canReceiveKeys();
186 inputWindowHandle.hasFocus = hasFocus;
187 inputWindowHandle.hasWallpaper = hasWallpaper;
188 inputWindowHandle.paused = child.mAppToken != null ? child.mAppToken.paused : false;
189 inputWindowHandle.layer = child.mLayer;
190 inputWindowHandle.ownerPid = child.mSession.mPid;
191 inputWindowHandle.ownerUid = child.mSession.mUid;
192 inputWindowHandle.inputFeatures = child.mAttrs.inputFeatures;
193
194 final Rect frame = child.mFrame;
195 inputWindowHandle.frameLeft = frame.left;
196 inputWindowHandle.frameTop = frame.top;
197 inputWindowHandle.frameRight = frame.right;
198 inputWindowHandle.frameBottom = frame.bottom;
199
200 if (child.mGlobalScale != 1) {
201 // If we are scaling the window, input coordinates need
202 // to be inversely scaled to map from what is on screen
203 // to what is actually being touched in the UI.
204 inputWindowHandle.scaleFactor = 1.0f/child.mGlobalScale;
205 } else {
206 inputWindowHandle.scaleFactor = 1;
207 }
208
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700209
210 addInputWindowHandleLw(inputWindowHandle);
211 }
212
Jeff Brown9302c872011-07-13 22:51:29 -0700213 private void clearInputWindowHandlesLw() {
214 while (mInputWindowHandleCount != 0) {
215 mInputWindowHandles[--mInputWindowHandleCount] = null;
216 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800217 }
218
219 public void setUpdateInputWindowsNeededLw() {
220 mUpdateInputWindowsNeeded = true;
221 }
222
223 /* Updates the cached window information provided to the input dispatcher. */
224 public void updateInputWindowsLw(boolean force) {
225 if (!force && !mUpdateInputWindowsNeeded) {
226 return;
227 }
228 mUpdateInputWindowsNeeded = false;
229
Dianne Hackbornb961cd22011-06-21 12:13:37 -0700230 if (false) Slog.d(WindowManagerService.TAG, ">>>>>> ENTERED updateInputWindowsLw");
Jeff Brown9302c872011-07-13 22:51:29 -0700231
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800232 // Populate the input window list with information about all of the windows that
233 // could potentially receive input.
234 // As an optimization, we could try to prune the list of windows but this turns
235 // out to be difficult because only the native code knows for sure which window
236 // currently has touch focus.
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700237 final WindowStateAnimator universeBackground = mService.mAnimator.mUniverseBackground;
238 final int aboveUniverseLayer = mService.mAnimator.mAboveUniverseLayer;
239 boolean addedUniverse = false;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800240
241 // If there's a drag in flight, provide a pseudowindow to catch drag input
242 final boolean inDrag = (mService.mDragState != null);
243 if (inDrag) {
244 if (WindowManagerService.DEBUG_DRAG) {
245 Log.d(WindowManagerService.TAG, "Inserting drag window");
246 }
Jeff Browncc4f7db2011-08-30 20:34:48 -0700247 final InputWindowHandle dragWindowHandle = mService.mDragState.mDragWindowHandle;
248 if (dragWindowHandle != null) {
249 addInputWindowHandleLw(dragWindowHandle);
250 } else {
251 Slog.w(WindowManagerService.TAG, "Drag is in progress but there is no "
252 + "drag window handle.");
253 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800254 }
255
Dianne Hackborndf89e652011-10-06 22:35:11 -0700256 final int NFW = mService.mFakeWindows.size();
257 for (int i = 0; i < NFW; i++) {
258 addInputWindowHandleLw(mService.mFakeWindows.get(i).mWindowHandle);
259 }
260
Jeff Brown83d616a2012-09-09 20:33:43 -0700261 // Add all windows on the default display.
262 final AllWindowsIterator iterator = mService.new AllWindowsIterator(
263 WindowManagerService.REVERSE_ITERATOR);
264 while (iterator.hasNext()) {
265 final WindowState child = iterator.next();
Jeff Browncc4f7db2011-08-30 20:34:48 -0700266 final InputChannel inputChannel = child.mInputChannel;
267 final InputWindowHandle inputWindowHandle = child.mInputWindowHandle;
268 if (inputChannel == null || inputWindowHandle == null || child.mRemoved) {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800269 // Skip this window because it cannot possibly receive input.
270 continue;
271 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700272
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800273 final int flags = child.mAttrs.flags;
274 final int type = child.mAttrs.type;
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700275
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800276 final boolean hasFocus = (child == mInputFocus);
277 final boolean isVisible = child.isVisibleLw();
278 final boolean hasWallpaper = (child == mService.mWallpaperTarget)
279 && (type != WindowManager.LayoutParams.TYPE_KEYGUARD);
Jeff Brown83d616a2012-09-09 20:33:43 -0700280 final boolean onDefaultDisplay = (child.getDisplayId() == Display.DEFAULT_DISPLAY);
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800281
282 // If there's a drag in progress and 'child' is a potential drop target,
283 // make sure it's been told about the drag
Jeff Brown83d616a2012-09-09 20:33:43 -0700284 if (inDrag && isVisible && onDefaultDisplay) {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800285 mService.mDragState.sendDragStartedIfNeededLw(child);
286 }
287
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700288 if (universeBackground != null && !addedUniverse
Jeff Brown83d616a2012-09-09 20:33:43 -0700289 && child.mBaseLayer < aboveUniverseLayer && onDefaultDisplay) {
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700290 final WindowState u = universeBackground.mWin;
291 if (u.mInputChannel != null && u.mInputWindowHandle != null) {
292 addInputWindowHandleLw(u.mInputWindowHandle, u, u.mAttrs.flags,
293 u.mAttrs.type, true, u == mInputFocus, false);
294 }
295 addedUniverse = true;
Dianne Hackborne2515ee2011-04-27 18:52:56 -0400296 }
297
Dianne Hackborna4b7f2f2012-05-21 11:28:41 -0700298 if (child.mWinAnimator != universeBackground) {
299 addInputWindowHandleLw(inputWindowHandle, child, flags, type,
300 isVisible, hasFocus, hasWallpaper);
301 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800302 }
303
304 // Send windows to native code.
Jeff Brown9302c872011-07-13 22:51:29 -0700305 mService.mInputManager.setInputWindows(mInputWindowHandles);
306
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800307 // Clear the list in preparation for the next round.
Jeff Brown9302c872011-07-13 22:51:29 -0700308 clearInputWindowHandlesLw();
309
Dianne Hackbornb961cd22011-06-21 12:13:37 -0700310 if (false) Slog.d(WindowManagerService.TAG, "<<<<<<< EXITED updateInputWindowsLw");
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800311 }
312
313 /* Notifies that the input device configuration has changed. */
314 public void notifyConfigurationChanged() {
315 mService.sendNewConfiguration();
316
317 synchronized (mInputDevicesReadyMonitor) {
318 if (!mInputDevicesReady) {
319 mInputDevicesReady = true;
320 mInputDevicesReadyMonitor.notifyAll();
321 }
322 }
323 }
324
325 /* Waits until the built-in input devices have been configured. */
326 public boolean waitForInputDevicesReady(long timeoutMillis) {
327 synchronized (mInputDevicesReadyMonitor) {
328 if (!mInputDevicesReady) {
329 try {
330 mInputDevicesReadyMonitor.wait(timeoutMillis);
331 } catch (InterruptedException ex) {
332 }
333 }
334 return mInputDevicesReady;
335 }
336 }
337
338 /* Notifies that the lid switch changed state. */
339 public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
340 mService.mPolicy.notifyLidSwitchChanged(whenNanos, lidOpen);
341 }
342
343 /* Provides an opportunity for the window manager policy to intercept early key
344 * processing as soon as the key has been read from the device. */
345 public int interceptKeyBeforeQueueing(
346 KeyEvent event, int policyFlags, boolean isScreenOn) {
347 return mService.mPolicy.interceptKeyBeforeQueueing(event, policyFlags, isScreenOn);
348 }
Jeff Brown56194eb2011-03-02 19:23:13 -0800349
350 /* Provides an opportunity for the window manager policy to intercept early
351 * motion event processing when the screen is off since these events are normally
352 * dropped. */
353 public int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags) {
354 return mService.mPolicy.interceptMotionBeforeQueueingWhenScreenOff(policyFlags);
355 }
356
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800357 /* Provides an opportunity for the window manager policy to process a key before
358 * ordinary dispatch. */
Jeff Brown905805a2011-10-12 13:57:59 -0700359 public long interceptKeyBeforeDispatching(
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800360 InputWindowHandle focus, KeyEvent event, int policyFlags) {
361 WindowState windowState = focus != null ? (WindowState) focus.windowState : null;
362 return mService.mPolicy.interceptKeyBeforeDispatching(windowState, event, policyFlags);
363 }
364
365 /* Provides an opportunity for the window manager policy to process a key that
366 * the application did not handle. */
367 public KeyEvent dispatchUnhandledKey(
368 InputWindowHandle focus, KeyEvent event, int policyFlags) {
369 WindowState windowState = focus != null ? (WindowState) focus.windowState : null;
370 return mService.mPolicy.dispatchUnhandledKey(windowState, event, policyFlags);
371 }
Jeff Brown4532e612012-04-05 14:27:12 -0700372
373 /* Callback to get pointer layer. */
374 public int getPointerLayer() {
375 return mService.mPolicy.windowTypeToLayerLw(WindowManager.LayoutParams.TYPE_POINTER)
376 * WindowManagerService.TYPE_LAYER_MULTIPLIER
377 + WindowManagerService.TYPE_LAYER_OFFSET;
378 }
379
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800380 /* Called when the current input focus changes.
381 * Layer assignment is assumed to be complete by the time this is called.
382 */
383 public void setInputFocusLw(WindowState newWindow, boolean updateInputWindows) {
384 if (WindowManagerService.DEBUG_INPUT) {
385 Slog.d(WindowManagerService.TAG, "Input focus has changed to " + newWindow);
386 }
387
388 if (newWindow != mInputFocus) {
389 if (newWindow != null && newWindow.canReceiveKeys()) {
390 // Displaying a window implicitly causes dispatching to be unpaused.
391 // This is to protect against bugs if someone pauses dispatching but
392 // forgets to resume.
393 newWindow.mToken.paused = false;
394 }
395
396 mInputFocus = newWindow;
397 setUpdateInputWindowsNeededLw();
398
399 if (updateInputWindows) {
400 updateInputWindowsLw(false /*force*/);
401 }
402 }
403 }
404
405 public void setFocusedAppLw(AppWindowToken newApp) {
406 // Focused app has changed.
407 if (newApp == null) {
408 mService.mInputManager.setFocusedApplication(null);
409 } else {
Jeff Brown9302c872011-07-13 22:51:29 -0700410 final InputApplicationHandle handle = newApp.mInputApplicationHandle;
411 handle.name = newApp.toString();
412 handle.dispatchingTimeoutNanos = newApp.inputDispatchingTimeoutNanos;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800413
Jeff Brown9302c872011-07-13 22:51:29 -0700414 mService.mInputManager.setFocusedApplication(handle);
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800415 }
416 }
417
418 public void pauseDispatchingLw(WindowToken window) {
419 if (! window.paused) {
420 if (WindowManagerService.DEBUG_INPUT) {
421 Slog.v(WindowManagerService.TAG, "Pausing WindowToken " + window);
422 }
423
424 window.paused = true;
425 updateInputWindowsLw(true /*force*/);
426 }
427 }
428
429 public void resumeDispatchingLw(WindowToken window) {
430 if (window.paused) {
431 if (WindowManagerService.DEBUG_INPUT) {
432 Slog.v(WindowManagerService.TAG, "Resuming WindowToken " + window);
433 }
434
435 window.paused = false;
436 updateInputWindowsLw(true /*force*/);
437 }
438 }
439
440 public void freezeInputDispatchingLw() {
441 if (! mInputDispatchFrozen) {
442 if (WindowManagerService.DEBUG_INPUT) {
443 Slog.v(WindowManagerService.TAG, "Freezing input dispatching");
444 }
445
446 mInputDispatchFrozen = true;
447 updateInputDispatchModeLw();
448 }
449 }
450
451 public void thawInputDispatchingLw() {
452 if (mInputDispatchFrozen) {
453 if (WindowManagerService.DEBUG_INPUT) {
454 Slog.v(WindowManagerService.TAG, "Thawing input dispatching");
455 }
456
457 mInputDispatchFrozen = false;
458 updateInputDispatchModeLw();
459 }
460 }
461
462 public void setEventDispatchingLw(boolean enabled) {
463 if (mInputDispatchEnabled != enabled) {
464 if (WindowManagerService.DEBUG_INPUT) {
465 Slog.v(WindowManagerService.TAG, "Setting event dispatching to " + enabled);
466 }
467
468 mInputDispatchEnabled = enabled;
469 updateInputDispatchModeLw();
470 }
471 }
472
473 private void updateInputDispatchModeLw() {
474 mService.mInputManager.setInputDispatchMode(mInputDispatchEnabled, mInputDispatchFrozen);
475 }
Jeff Brownea426552011-07-18 16:53:48 -0700476}