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 | |
Jorim Jaggi | 4981f15 | 2019-03-26 18:58:45 +0100 | [diff] [blame^] | 19 | import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; |
Wale Ogunwale | 6213caa | 2016-12-02 16:47:15 +0000 | [diff] [blame] | 20 | import static android.view.WindowManager.INPUT_CONSUMER_NAVIGATION; |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 21 | import static android.view.WindowManager.INPUT_CONSUMER_PIP; |
Winson Chung | a89ffed | 2018-01-25 17:46:11 +0000 | [diff] [blame] | 22 | import static android.view.WindowManager.INPUT_CONSUMER_RECENTS_ANIMATION; |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 23 | import static android.view.WindowManager.INPUT_CONSUMER_WALLPAPER; |
Wale Ogunwale | f7cab10 | 2016-10-25 15:25:14 -0700 | [diff] [blame] | 24 | import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL; |
Wale Ogunwale | 6213caa | 2016-12-02 16:47:15 +0000 | [diff] [blame] | 25 | import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS; |
| 26 | import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD; |
| 27 | import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; |
Winson Chung | 6463c36 | 2017-09-25 16:23:26 -0700 | [diff] [blame] | 28 | |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 29 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS_LIGHT; |
| 30 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_INPUT; |
| 31 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TASK_POSITIONING; |
| 32 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; |
Filip Gruszczynski | 9cac3b4 | 2015-10-30 14:20:37 -0700 | [diff] [blame] | 33 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 34 | import android.graphics.Rect; |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 35 | import android.os.Handler; |
Winson Chung | 6463c36 | 2017-09-25 16:23:26 -0700 | [diff] [blame] | 36 | import android.os.IBinder; |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 37 | import android.os.Looper; |
Winson Chung | 6463c36 | 2017-09-25 16:23:26 -0700 | [diff] [blame] | 38 | import android.os.Process; |
Jorim Jaggi | 6064051 | 2018-06-29 01:14:31 +0200 | [diff] [blame] | 39 | import android.os.Trace; |
Winson Chung | 6463c36 | 2017-09-25 16:23:26 -0700 | [diff] [blame] | 40 | import android.os.UserHandle; |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 41 | import android.util.ArrayMap; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 42 | import android.util.Log; |
| 43 | import android.util.Slog; |
wilsonshih | c32538e | 2018-11-07 17:27:34 +0800 | [diff] [blame] | 44 | import android.view.InputApplicationHandle; |
Jeff Brown | cc4f7db | 2011-08-30 20:34:48 -0700 | [diff] [blame] | 45 | import android.view.InputChannel; |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 46 | import android.view.InputEventReceiver; |
Robert Carr | 788f574 | 2018-07-30 17:46:45 -0700 | [diff] [blame] | 47 | import android.view.InputWindowHandle; |
Robert Carr | 679ccb0 | 2018-08-08 15:32:35 -0700 | [diff] [blame] | 48 | import android.view.SurfaceControl; |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 49 | |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 50 | import com.android.server.AnimationThread; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 51 | import com.android.server.policy.WindowManagerPolicy; |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 52 | |
Wale Ogunwale | e89eeac | 2016-03-12 11:07:58 -0800 | [diff] [blame] | 53 | import java.io.PrintWriter; |
Winson Chung | 853c99a | 2017-03-21 22:16:42 -0700 | [diff] [blame] | 54 | import java.util.Set; |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 55 | import java.util.function.Consumer; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 56 | |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 57 | final class InputMonitor { |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 58 | private final WindowManagerService mService; |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 59 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 60 | // Current window with input focus for keys and other non-touch events. May be null. |
| 61 | private WindowState mInputFocus; |
Selim Cinek | f83e824 | 2015-05-19 18:08:14 -0700 | [diff] [blame] | 62 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 63 | // When true, need to call updateInputWindowsLw(). |
| 64 | private boolean mUpdateInputWindowsNeeded = true; |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 65 | private boolean mUpdateInputWindowsPending; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 66 | |
Robert Carr | b600bc2 | 2018-08-21 15:05:16 -0700 | [diff] [blame] | 67 | // Currently focused input window handle. |
| 68 | private InputWindowHandle mFocusedInputWindowHandle; |
Vladislav Kaznacheev | 3787de1 | 2016-12-21 10:36:35 -0800 | [diff] [blame] | 69 | |
Wale Ogunwale | 6213caa | 2016-12-02 16:47:15 +0000 | [diff] [blame] | 70 | private boolean mDisableWallpaperTouchEvents; |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 71 | private final Rect mTmpRect = new Rect(); |
Arthur Hung | 678024f | 2019-01-16 20:58:51 +0800 | [diff] [blame] | 72 | private final UpdateInputForAllWindowsConsumer mUpdateInputForAllWindowsConsumer; |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 73 | |
Vishnu Nair | 9e7dbc8 | 2018-12-20 08:45:28 -0800 | [diff] [blame] | 74 | private final int mDisplayId; |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 75 | private final DisplayContent mDisplayContent; |
| 76 | private boolean mDisplayRemoved; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 77 | |
Vishnu Nair | 9e7dbc8 | 2018-12-20 08:45:28 -0800 | [diff] [blame] | 78 | private final SurfaceControl.Transaction mInputTransaction; |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 79 | private final Handler mHandler; |
Robert Carr | 679ccb0 | 2018-08-08 15:32:35 -0700 | [diff] [blame] | 80 | |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 81 | /** |
| 82 | * The set of input consumer added to the window manager by name, which consumes input events |
| 83 | * for the windows below it. |
| 84 | */ |
| 85 | private final ArrayMap<String, InputConsumerImpl> mInputConsumers = new ArrayMap(); |
| 86 | |
| 87 | private static final class EventReceiverInputConsumer extends InputConsumerImpl |
| 88 | implements WindowManagerPolicy.InputConsumer { |
| 89 | private InputMonitor mInputMonitor; |
| 90 | private final InputEventReceiver mInputEventReceiver; |
| 91 | |
| 92 | EventReceiverInputConsumer(WindowManagerService service, InputMonitor monitor, |
| 93 | Looper looper, String name, |
Winson Chung | 6463c36 | 2017-09-25 16:23:26 -0700 | [diff] [blame] | 94 | InputEventReceiver.Factory inputEventReceiverFactory, |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 95 | int clientPid, UserHandle clientUser, int displayId) { |
| 96 | super(service, null /* token */, name, null /* inputChannel */, clientPid, clientUser, |
| 97 | displayId); |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 98 | mInputMonitor = monitor; |
| 99 | mInputEventReceiver = inputEventReceiverFactory.createInputEventReceiver( |
| 100 | mClientChannel, looper); |
| 101 | } |
| 102 | |
| 103 | @Override |
| 104 | public void dismiss() { |
Wale Ogunwale | db485de | 2018-10-29 09:47:07 -0700 | [diff] [blame] | 105 | synchronized (mService.mGlobalLock) { |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 106 | if (mInputMonitor.destroyInputConsumer(mWindowHandle.name)) { |
| 107 | mInputEventReceiver.dispose(); |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 113 | private final Runnable mUpdateInputWindows = new Runnable() { |
| 114 | @Override |
| 115 | public void run() { |
| 116 | synchronized (mService.mGlobalLock) { |
| 117 | mUpdateInputWindowsPending = false; |
| 118 | mUpdateInputWindowsNeeded = false; |
| 119 | |
| 120 | if (mDisplayRemoved) { |
| 121 | return; |
| 122 | } |
| 123 | |
| 124 | // Populate the input window list with information about all of the windows that |
| 125 | // could potentially receive input. |
| 126 | // As an optimization, we could try to prune the list of windows but this turns |
| 127 | // out to be difficult because only the native code knows for sure which window |
| 128 | // currently has touch focus. |
| 129 | |
| 130 | // If there's a drag in flight, provide a pseudo-window to catch drag input |
| 131 | final boolean inDrag = mService.mDragDropController.dragDropActiveLocked(); |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 132 | final boolean inPositioning = |
| 133 | mService.mTaskPositioningController.isPositioningLocked(); |
| 134 | if (inPositioning) { |
| 135 | if (DEBUG_TASK_POSITIONING) { |
| 136 | Log.d(TAG_WM, "Inserting window handle for repositioning"); |
| 137 | } |
| 138 | mService.mTaskPositioningController.showInputSurface(mInputTransaction, |
| 139 | mDisplayId); |
| 140 | } else { |
| 141 | mService.mTaskPositioningController.hideInputSurface(mInputTransaction, |
| 142 | mDisplayId); |
| 143 | } |
| 144 | |
| 145 | // Add all windows on the default display. |
| 146 | mUpdateInputForAllWindowsConsumer.updateInputWindows(inDrag); |
| 147 | } |
| 148 | } |
| 149 | }; |
| 150 | |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 151 | public InputMonitor(WindowManagerService service, int displayId) { |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 152 | mService = service; |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 153 | mDisplayContent = mService.mRoot.getDisplayContent(displayId); |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 154 | mDisplayId = displayId; |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 155 | mInputTransaction = mDisplayContent.getPendingTransaction(); |
| 156 | mHandler = AnimationThread.getHandler(); |
Arthur Hung | 678024f | 2019-01-16 20:58:51 +0800 | [diff] [blame] | 157 | mUpdateInputForAllWindowsConsumer = new UpdateInputForAllWindowsConsumer(); |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | void onDisplayRemoved() { |
| 161 | mHandler.removeCallbacks(mUpdateInputWindows); |
Riddle Hsu | 3f2de74 | 2019-02-25 15:21:38 +0800 | [diff] [blame] | 162 | mService.mInputManager.onDisplayRemoved(mDisplayId); |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 163 | mDisplayRemoved = true; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 164 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 165 | |
Wale Ogunwale | f7cab10 | 2016-10-25 15:25:14 -0700 | [diff] [blame] | 166 | private void addInputConsumer(String name, InputConsumerImpl consumer) { |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 167 | mInputConsumers.put(name, consumer); |
Winson Chung | 6463c36 | 2017-09-25 16:23:26 -0700 | [diff] [blame] | 168 | consumer.linkToDeathRecipient(); |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 169 | updateInputWindowsLw(true /* force */); |
| 170 | } |
| 171 | |
| 172 | boolean destroyInputConsumer(String name) { |
| 173 | if (disposeInputConsumer(mInputConsumers.remove(name))) { |
| 174 | updateInputWindowsLw(true /* force */); |
| 175 | return true; |
| 176 | } |
| 177 | return false; |
| 178 | } |
| 179 | |
| 180 | private boolean disposeInputConsumer(InputConsumerImpl consumer) { |
| 181 | if (consumer != null) { |
| 182 | consumer.disposeChannelsLw(); |
Robert Carr | a80ad04 | 2018-08-14 12:54:20 -0700 | [diff] [blame] | 183 | consumer.hide(mInputTransaction); |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 184 | return true; |
| 185 | } |
| 186 | return false; |
| 187 | } |
| 188 | |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 189 | InputConsumerImpl getInputConsumer(String name) { |
| 190 | return mInputConsumers.get(name); |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | void layoutInputConsumers(int dw, int dh) { |
Jorim Jaggi | 4981f15 | 2019-03-26 18:58:45 +0100 | [diff] [blame^] | 194 | try { |
| 195 | Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "layoutInputConsumer"); |
| 196 | for (int i = mInputConsumers.size() - 1; i >= 0; i--) { |
| 197 | mInputConsumers.valueAt(i).layout(mInputTransaction, dw, dh); |
| 198 | } |
| 199 | } finally { |
| 200 | Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); |
Robert Carr | a80ad04 | 2018-08-14 12:54:20 -0700 | [diff] [blame] | 201 | } |
| 202 | } |
| 203 | |
| 204 | // The visibility of the input consumers is recomputed each time we |
| 205 | // update the input windows. We use a model where consumers begin invisible |
| 206 | // (set so by this function) and must meet some condition for visibility on each update. |
| 207 | void resetInputConsumers(SurfaceControl.Transaction t) { |
| 208 | for (int i = mInputConsumers.size() - 1; i >= 0; i--) { |
| 209 | mInputConsumers.valueAt(i).hide(t); |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 210 | } |
| 211 | } |
| 212 | |
| 213 | WindowManagerPolicy.InputConsumer createInputConsumer(Looper looper, String name, |
| 214 | InputEventReceiver.Factory inputEventReceiverFactory) { |
| 215 | if (mInputConsumers.containsKey(name)) { |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 216 | throw new IllegalStateException("Existing input consumer found with name: " + name |
| 217 | + ", display: " + mDisplayId); |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 218 | } |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 219 | final EventReceiverInputConsumer consumer = new EventReceiverInputConsumer(mService, |
Winson Chung | 6463c36 | 2017-09-25 16:23:26 -0700 | [diff] [blame] | 220 | this, looper, name, inputEventReceiverFactory, Process.myPid(), |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 221 | UserHandle.SYSTEM, mDisplayId); |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 222 | addInputConsumer(name, consumer); |
| 223 | return consumer; |
| 224 | } |
| 225 | |
Winson Chung | 6463c36 | 2017-09-25 16:23:26 -0700 | [diff] [blame] | 226 | void createInputConsumer(IBinder token, String name, InputChannel inputChannel, int clientPid, |
| 227 | UserHandle clientUser) { |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 228 | if (mInputConsumers.containsKey(name)) { |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 229 | throw new IllegalStateException("Existing input consumer found with name: " + name |
| 230 | + ", display: " + mDisplayId); |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 231 | } |
| 232 | |
Winson Chung | 6463c36 | 2017-09-25 16:23:26 -0700 | [diff] [blame] | 233 | final InputConsumerImpl consumer = new InputConsumerImpl(mService, token, name, |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 234 | inputChannel, clientPid, clientUser, mDisplayId); |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 235 | switch (name) { |
| 236 | case INPUT_CONSUMER_WALLPAPER: |
| 237 | consumer.mWindowHandle.hasWallpaper = true; |
| 238 | break; |
| 239 | case INPUT_CONSUMER_PIP: |
| 240 | // The touchable region of the Pip input window is cropped to the bounds of the |
| 241 | // stack, and we need FLAG_NOT_TOUCH_MODAL to ensure other events fall through |
Wale Ogunwale | f7cab10 | 2016-10-25 15:25:14 -0700 | [diff] [blame] | 242 | consumer.mWindowHandle.layoutParamsFlags |= FLAG_NOT_TOUCH_MODAL; |
Winson | 4127548 | 2016-10-10 15:17:45 -0700 | [diff] [blame] | 243 | break; |
| 244 | } |
| 245 | addInputConsumer(name, consumer); |
| 246 | } |
| 247 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 248 | |
Robert Carr | b600bc2 | 2018-08-21 15:05:16 -0700 | [diff] [blame] | 249 | void populateInputWindowHandle(final InputWindowHandle inputWindowHandle, |
Craig Mautner | c08eab8 | 2014-11-11 09:03:59 -0800 | [diff] [blame] | 250 | final WindowState child, int flags, final int type, final boolean isVisible, |
Wale Ogunwale | 053c8e4 | 2015-11-16 14:27:21 -0800 | [diff] [blame] | 251 | final boolean hasFocus, final boolean hasWallpaper) { |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 252 | // Add a window to our list of input windows. |
| 253 | inputWindowHandle.name = child.toString(); |
Riddle Hsu | ff03df5 | 2018-12-05 21:43:02 +0800 | [diff] [blame] | 254 | flags = child.getSurfaceTouchableRegion(inputWindowHandle.touchableRegion, flags); |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 255 | inputWindowHandle.layoutParamsFlags = flags; |
| 256 | inputWindowHandle.layoutParamsType = type; |
| 257 | inputWindowHandle.dispatchingTimeoutNanos = child.getInputDispatchingTimeoutNanos(); |
| 258 | inputWindowHandle.visible = isVisible; |
| 259 | inputWindowHandle.canReceiveKeys = child.canReceiveKeys(); |
| 260 | inputWindowHandle.hasFocus = hasFocus; |
| 261 | inputWindowHandle.hasWallpaper = hasWallpaper; |
| 262 | inputWindowHandle.paused = child.mAppToken != null ? child.mAppToken.paused : false; |
| 263 | inputWindowHandle.layer = child.mLayer; |
| 264 | inputWindowHandle.ownerPid = child.mSession.mPid; |
| 265 | inputWindowHandle.ownerUid = child.mSession.mUid; |
| 266 | inputWindowHandle.inputFeatures = child.mAttrs.inputFeatures; |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 267 | inputWindowHandle.displayId = child.getDisplayId(); |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 268 | |
chaviw | 492139a | 2018-07-16 16:07:35 -0700 | [diff] [blame] | 269 | final Rect frame = child.getFrameLw(); |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 270 | inputWindowHandle.frameLeft = frame.left; |
| 271 | inputWindowHandle.frameTop = frame.top; |
| 272 | inputWindowHandle.frameRight = frame.right; |
| 273 | inputWindowHandle.frameBottom = frame.bottom; |
| 274 | |
Robert Carr | fcc0852 | 2018-11-14 14:02:52 -0800 | [diff] [blame] | 275 | // Surface insets are hardcoded to be the same in all directions |
| 276 | // and we could probably deprecate the "left/right/top/bottom" concept. |
| 277 | // we avoid reintroducing this concept by just choosing one of them here. |
| 278 | inputWindowHandle.surfaceInset = child.getAttrs().surfaceInsets.left; |
| 279 | |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 280 | if (child.mGlobalScale != 1) { |
| 281 | // If we are scaling the window, input coordinates need |
| 282 | // to be inversely scaled to map from what is on screen |
| 283 | // to what is actually being touched in the UI. |
| 284 | inputWindowHandle.scaleFactor = 1.0f/child.mGlobalScale; |
| 285 | } else { |
| 286 | inputWindowHandle.scaleFactor = 1; |
| 287 | } |
| 288 | |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 289 | if (DEBUG_INPUT) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 290 | Slog.d(TAG_WM, "addInputWindowHandle: " |
Chong Zhang | b15758a | 2015-11-17 12:12:03 -0800 | [diff] [blame] | 291 | + child + ", " + inputWindowHandle); |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 292 | } |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 293 | |
Robert Carr | b600bc2 | 2018-08-21 15:05:16 -0700 | [diff] [blame] | 294 | if (hasFocus) { |
| 295 | mFocusedInputWindowHandle = inputWindowHandle; |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 296 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 297 | } |
| 298 | |
Wale Ogunwale | 6213caa | 2016-12-02 16:47:15 +0000 | [diff] [blame] | 299 | void setUpdateInputWindowsNeededLw() { |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 300 | mUpdateInputWindowsNeeded = true; |
| 301 | } |
| 302 | |
| 303 | /* Updates the cached window information provided to the input dispatcher. */ |
Wale Ogunwale | 6213caa | 2016-12-02 16:47:15 +0000 | [diff] [blame] | 304 | void updateInputWindowsLw(boolean force) { |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 305 | if (!force && !mUpdateInputWindowsNeeded) { |
| 306 | return; |
| 307 | } |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 308 | scheduleUpdateInputWindows(); |
| 309 | } |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 310 | |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 311 | private void scheduleUpdateInputWindows() { |
| 312 | if (mDisplayRemoved) { |
| 313 | return; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 314 | } |
| 315 | |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 316 | if (!mUpdateInputWindowsPending) { |
| 317 | mUpdateInputWindowsPending = true; |
| 318 | mHandler.post(mUpdateInputWindows); |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 319 | } |
Wale Ogunwale | 6213caa | 2016-12-02 16:47:15 +0000 | [diff] [blame] | 320 | } |
| 321 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 322 | /* Called when the current input focus changes. |
| 323 | * Layer assignment is assumed to be complete by the time this is called. |
| 324 | */ |
| 325 | public void setInputFocusLw(WindowState newWindow, boolean updateInputWindows) { |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 326 | if (DEBUG_FOCUS_LIGHT || DEBUG_INPUT) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 327 | Slog.d(TAG_WM, "Input focus has changed to " + newWindow); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | if (newWindow != mInputFocus) { |
| 331 | if (newWindow != null && newWindow.canReceiveKeys()) { |
| 332 | // Displaying a window implicitly causes dispatching to be unpaused. |
| 333 | // This is to protect against bugs if someone pauses dispatching but |
| 334 | // forgets to resume. |
| 335 | newWindow.mToken.paused = false; |
| 336 | } |
| 337 | |
| 338 | mInputFocus = newWindow; |
| 339 | setUpdateInputWindowsNeededLw(); |
| 340 | |
| 341 | if (updateInputWindows) { |
| 342 | updateInputWindowsLw(false /*force*/); |
| 343 | } |
| 344 | } |
| 345 | } |
Craig Mautner | 5845812 | 2013-09-14 14:59:50 -0700 | [diff] [blame] | 346 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 347 | public void setFocusedAppLw(AppWindowToken newApp) { |
| 348 | // Focused app has changed. |
| 349 | if (newApp == null) { |
Tiger Huang | 1e5b10a | 2018-07-30 20:19:51 +0800 | [diff] [blame] | 350 | mService.mInputManager.setFocusedApplication(mDisplayId, null); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 351 | } else { |
Jeff Brown | 9302c87 | 2011-07-13 22:51:29 -0700 | [diff] [blame] | 352 | final InputApplicationHandle handle = newApp.mInputApplicationHandle; |
| 353 | handle.name = newApp.toString(); |
Wale Ogunwale | 72919d2 | 2016-12-08 18:58:50 -0800 | [diff] [blame] | 354 | handle.dispatchingTimeoutNanos = newApp.mInputDispatchingTimeoutNanos; |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 355 | |
Tiger Huang | 1e5b10a | 2018-07-30 20:19:51 +0800 | [diff] [blame] | 356 | mService.mInputManager.setFocusedApplication(mDisplayId, handle); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 357 | } |
| 358 | } |
Craig Mautner | 5845812 | 2013-09-14 14:59:50 -0700 | [diff] [blame] | 359 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 360 | public void pauseDispatchingLw(WindowToken window) { |
| 361 | if (! window.paused) { |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 362 | if (DEBUG_INPUT) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 363 | Slog.v(TAG_WM, "Pausing WindowToken " + window); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 364 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 365 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 366 | window.paused = true; |
| 367 | updateInputWindowsLw(true /*force*/); |
| 368 | } |
| 369 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 370 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 371 | public void resumeDispatchingLw(WindowToken window) { |
| 372 | if (window.paused) { |
Filip Gruszczynski | f8a2a63 | 2015-10-28 11:18:02 -0700 | [diff] [blame] | 373 | if (DEBUG_INPUT) { |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 374 | Slog.v(TAG_WM, "Resuming WindowToken " + window); |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 375 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 376 | |
Dianne Hackborn | 6e1eb76 | 2011-02-17 16:07:28 -0800 | [diff] [blame] | 377 | window.paused = false; |
| 378 | updateInputWindowsLw(true /*force*/); |
| 379 | } |
| 380 | } |
Chong Zhang | 8e89b31 | 2015-09-09 15:09:30 -0700 | [diff] [blame] | 381 | |
Wale Ogunwale | e89eeac | 2016-03-12 11:07:58 -0800 | [diff] [blame] | 382 | void dump(PrintWriter pw, String prefix) { |
Winson Chung | 853c99a | 2017-03-21 22:16:42 -0700 | [diff] [blame] | 383 | final Set<String> inputConsumerKeys = mInputConsumers.keySet(); |
| 384 | if (!inputConsumerKeys.isEmpty()) { |
| 385 | pw.println(prefix + "InputConsumers:"); |
| 386 | for (String key : inputConsumerKeys) { |
Winson Chung | 6463c36 | 2017-09-25 16:23:26 -0700 | [diff] [blame] | 387 | mInputConsumers.get(key).dump(pw, key, prefix); |
Winson Chung | 853c99a | 2017-03-21 22:16:42 -0700 | [diff] [blame] | 388 | } |
| 389 | } |
Wale Ogunwale | e89eeac | 2016-03-12 11:07:58 -0800 | [diff] [blame] | 390 | } |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 391 | |
| 392 | private final class UpdateInputForAllWindowsConsumer implements Consumer<WindowState> { |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 393 | InputConsumerImpl navInputConsumer; |
| 394 | InputConsumerImpl pipInputConsumer; |
| 395 | InputConsumerImpl wallpaperInputConsumer; |
Winson Chung | a89ffed | 2018-01-25 17:46:11 +0000 | [diff] [blame] | 396 | InputConsumerImpl recentsAnimationInputConsumer; |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 397 | |
| 398 | private boolean mAddInputConsumerHandle; |
| 399 | private boolean mAddPipInputConsumerHandle; |
| 400 | private boolean mAddWallpaperInputConsumerHandle; |
| 401 | private boolean mAddRecentsAnimationInputConsumerHandle; |
| 402 | |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 403 | boolean inDrag; |
| 404 | WallpaperController wallpaperController; |
| 405 | |
Arthur Hung | 678024f | 2019-01-16 20:58:51 +0800 | [diff] [blame] | 406 | // An invalid window handle that tells SurfaceFlinger not update the input info. |
| 407 | final InputWindowHandle mInvalidInputWindow = new InputWindowHandle(null, null, mDisplayId); |
| 408 | |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 409 | private void updateInputWindows(boolean inDrag) { |
Jorim Jaggi | 4981f15 | 2019-03-26 18:58:45 +0100 | [diff] [blame^] | 410 | Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "updateInputWindows"); |
Jorim Jaggi | 6064051 | 2018-06-29 01:14:31 +0200 | [diff] [blame] | 411 | |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 412 | navInputConsumer = getInputConsumer(INPUT_CONSUMER_NAVIGATION); |
| 413 | pipInputConsumer = getInputConsumer(INPUT_CONSUMER_PIP); |
| 414 | wallpaperInputConsumer = getInputConsumer(INPUT_CONSUMER_WALLPAPER); |
| 415 | recentsAnimationInputConsumer = getInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION); |
| 416 | |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 417 | mAddInputConsumerHandle = navInputConsumer != null; |
| 418 | mAddPipInputConsumerHandle = pipInputConsumer != null; |
| 419 | mAddWallpaperInputConsumerHandle = wallpaperInputConsumer != null; |
Winson Chung | a89ffed | 2018-01-25 17:46:11 +0000 | [diff] [blame] | 420 | mAddRecentsAnimationInputConsumerHandle = recentsAnimationInputConsumer != null; |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 421 | |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 422 | mTmpRect.setEmpty(); |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 423 | mDisableWallpaperTouchEvents = false; |
| 424 | this.inDrag = inDrag; |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 425 | wallpaperController = mDisplayContent.mWallpaperController; |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 426 | |
Robert Carr | a80ad04 | 2018-08-14 12:54:20 -0700 | [diff] [blame] | 427 | resetInputConsumers(mInputTransaction); |
| 428 | |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 429 | mDisplayContent.forAllWindows(this, |
Robert Carr | a80ad04 | 2018-08-14 12:54:20 -0700 | [diff] [blame] | 430 | true /* traverseTopToBottom */); |
| 431 | |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 432 | if (mAddWallpaperInputConsumerHandle) { |
Robert Carr | b600bc2 | 2018-08-21 15:05:16 -0700 | [diff] [blame] | 433 | wallpaperInputConsumer.show(mInputTransaction, 0); |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 434 | } |
| 435 | |
Jorim Jaggi | ae962e6 | 2018-12-27 17:23:48 +0100 | [diff] [blame] | 436 | mDisplayContent.scheduleAnimation(); |
Vladislav Kaznacheev | 2e96c63 | 2016-12-13 14:31:24 -0800 | [diff] [blame] | 437 | |
Jorim Jaggi | 4981f15 | 2019-03-26 18:58:45 +0100 | [diff] [blame^] | 438 | Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 439 | } |
| 440 | |
| 441 | @Override |
| 442 | public void accept(WindowState w) { |
| 443 | final InputChannel inputChannel = w.mInputChannel; |
| 444 | final InputWindowHandle inputWindowHandle = w.mInputWindowHandle; |
| 445 | if (inputChannel == null || inputWindowHandle == null || w.mRemoved |
Robert Carr | ebdf858 | 2018-09-04 14:50:15 -0700 | [diff] [blame] | 446 | || w.cantReceiveTouchInput()) { |
Arthur Hung | 678024f | 2019-01-16 20:58:51 +0800 | [diff] [blame] | 447 | if (w.mWinAnimator.hasSurface()) { |
| 448 | mInputTransaction.setInputWindowInfo( |
| 449 | w.mWinAnimator.mSurfaceController.mSurfaceControl, mInvalidInputWindow); |
| 450 | } |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 451 | // Skip this window because it cannot possibly receive input. |
| 452 | return; |
| 453 | } |
| 454 | |
Winson Chung | 61ecc1b | 2017-02-17 10:46:17 -0800 | [diff] [blame] | 455 | final int flags = w.mAttrs.flags; |
| 456 | final int privateFlags = w.mAttrs.privateFlags; |
| 457 | final int type = w.mAttrs.type; |
Arthur Hung | 39134b2 | 2018-08-14 11:58:28 +0800 | [diff] [blame] | 458 | final boolean hasFocus = w.isFocused(); |
Winson Chung | 61ecc1b | 2017-02-17 10:46:17 -0800 | [diff] [blame] | 459 | final boolean isVisible = w.isVisibleLw(); |
| 460 | |
Winson Chung | a89ffed | 2018-01-25 17:46:11 +0000 | [diff] [blame] | 461 | if (mAddRecentsAnimationInputConsumerHandle) { |
| 462 | final RecentsAnimationController recentsAnimationController = |
| 463 | mService.getRecentsAnimationController(); |
| 464 | if (recentsAnimationController != null |
Winson Chung | db111ee | 2018-10-03 14:25:34 -0700 | [diff] [blame] | 465 | && recentsAnimationController.shouldApplyInputConsumer(w.mAppToken)) { |
Winson Chung | a89ffed | 2018-01-25 17:46:11 +0000 | [diff] [blame] | 466 | if (recentsAnimationController.updateInputConsumerForApp( |
Arthur Hung | 95b38a9 | 2018-07-20 18:56:12 +0800 | [diff] [blame] | 467 | recentsAnimationInputConsumer.mWindowHandle, hasFocus)) { |
Robert Carr | a80ad04 | 2018-08-14 12:54:20 -0700 | [diff] [blame] | 468 | recentsAnimationInputConsumer.show(mInputTransaction, w); |
Winson Chung | a89ffed | 2018-01-25 17:46:11 +0000 | [diff] [blame] | 469 | mAddRecentsAnimationInputConsumerHandle = false; |
| 470 | } |
Winson Chung | a89ffed | 2018-01-25 17:46:11 +0000 | [diff] [blame] | 471 | } |
| 472 | } |
| 473 | |
Wale Ogunwale | 44f036f | 2017-09-29 05:09:09 -0700 | [diff] [blame] | 474 | if (w.inPinnedWindowingMode()) { |
Robert Carr | a80ad04 | 2018-08-14 12:54:20 -0700 | [diff] [blame] | 475 | if (mAddPipInputConsumerHandle) { |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 476 | // Update the bounds of the Pip input consumer to match the window bounds. |
Winson Chung | a89ffed | 2018-01-25 17:46:11 +0000 | [diff] [blame] | 477 | w.getBounds(mTmpRect); |
Robert Carr | a80ad04 | 2018-08-14 12:54:20 -0700 | [diff] [blame] | 478 | pipInputConsumer.layout(mInputTransaction, mTmpRect); |
Robert Carr | 47ea21d | 2018-11-28 13:42:45 -0800 | [diff] [blame] | 479 | |
| 480 | // The touchable region is relative to the surface top-left |
| 481 | mTmpRect.offsetTo(0, 0); |
Winson Chung | a89ffed | 2018-01-25 17:46:11 +0000 | [diff] [blame] | 482 | pipInputConsumer.mWindowHandle.touchableRegion.set(mTmpRect); |
Robert Carr | a80ad04 | 2018-08-14 12:54:20 -0700 | [diff] [blame] | 483 | pipInputConsumer.show(mInputTransaction, w); |
Winson Chung | 61ecc1b | 2017-02-17 10:46:17 -0800 | [diff] [blame] | 484 | mAddPipInputConsumerHandle = false; |
| 485 | } |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 486 | } |
| 487 | |
| 488 | if (mAddInputConsumerHandle |
| 489 | && inputWindowHandle.layer <= navInputConsumer.mWindowHandle.layer) { |
Robert Carr | a80ad04 | 2018-08-14 12:54:20 -0700 | [diff] [blame] | 490 | navInputConsumer.show(mInputTransaction, w); |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 491 | mAddInputConsumerHandle = false; |
| 492 | } |
| 493 | |
| 494 | if (mAddWallpaperInputConsumerHandle) { |
| 495 | if (w.mAttrs.type == TYPE_WALLPAPER && w.isVisibleLw()) { |
| 496 | // Add the wallpaper input consumer above the first visible wallpaper. |
Robert Carr | a80ad04 | 2018-08-14 12:54:20 -0700 | [diff] [blame] | 497 | wallpaperInputConsumer.show(mInputTransaction, w); |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 498 | mAddWallpaperInputConsumerHandle = false; |
| 499 | } |
| 500 | } |
| 501 | |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 502 | if ((privateFlags & PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS) != 0) { |
| 503 | mDisableWallpaperTouchEvents = true; |
| 504 | } |
| 505 | final boolean hasWallpaper = wallpaperController.isWallpaperTarget(w) |
| 506 | && (privateFlags & PRIVATE_FLAG_KEYGUARD) == 0 |
| 507 | && !mDisableWallpaperTouchEvents; |
| 508 | |
| 509 | // If there's a drag in progress and 'child' is a potential drop target, |
| 510 | // make sure it's been told about the drag |
| 511 | if (inDrag && isVisible && w.getDisplayContent().isDefaultDisplay) { |
Daichi Hirono | 768012e | 2017-10-30 10:05:37 +0900 | [diff] [blame] | 512 | mService.mDragDropController.sendDragStartedIfNeededLocked(w); |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 513 | } |
| 514 | |
Robert Carr | b600bc2 | 2018-08-21 15:05:16 -0700 | [diff] [blame] | 515 | populateInputWindowHandle( |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 516 | inputWindowHandle, w, flags, type, isVisible, hasFocus, hasWallpaper); |
Robert Carr | 679ccb0 | 2018-08-08 15:32:35 -0700 | [diff] [blame] | 517 | |
| 518 | if (w.mWinAnimator.hasSurface()) { |
| 519 | mInputTransaction.setInputWindowInfo( |
| 520 | w.mWinAnimator.mSurfaceController.mSurfaceControl, inputWindowHandle); |
| 521 | } |
Wale Ogunwale | 1e129a4 | 2016-11-21 13:03:47 -0800 | [diff] [blame] | 522 | } |
| 523 | } |
Jeff Brown | ea42655 | 2011-07-18 16:53:48 -0700 | [diff] [blame] | 524 | } |