Fix WM input limitations on secondary displays (2/N)
One DisplayContent contains one InputMonitor now.
- Change setInputWindow of InputManagerService to carry displayId,
so InputWindowHandle can be updated by each DisplayContent.
- Only one focus in current, so reference the WMS current focus,
need changed in focus of multi-display patch.
- Change InputConsumerController can just create in default display,
need consider more behaviors about adding to another display.
Bug: 111363643
Test: atest WindowManagerSmokeTest ActivityManagerMultiDisplayTests
Test: atest libinput_tests inputflinger_tests
Change-Id: I336945abdd36a543207e15650264280b04253eef
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index 52f2d67..f5f19f6 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -210,7 +210,7 @@
const sp<InputWindowHandle>& inputWindowHandle, bool monitor);
status_t unregisterInputChannel(JNIEnv* env, const sp<InputChannel>& inputChannel);
- void setInputWindows(JNIEnv* env, jobjectArray windowHandleObjArray);
+ void setInputWindows(JNIEnv* env, jobjectArray windowHandleObjArray, int displayId);
void setFocusedApplication(JNIEnv* env, jobject applicationHandleObj);
void setInputDispatchMode(bool enabled, bool frozen);
void setSystemUiVisibility(int32_t visibility);
@@ -736,7 +736,8 @@
}
}
-void NativeInputManager::setInputWindows(JNIEnv* env, jobjectArray windowHandleObjArray) {
+void NativeInputManager::setInputWindows(JNIEnv* env, jobjectArray windowHandleObjArray,
+ int displayId) {
Vector<sp<InputWindowHandle> > windowHandles;
if (windowHandleObjArray) {
@@ -756,7 +757,7 @@
}
}
- mInputManager->getDispatcher()->setInputWindows(windowHandles);
+ mInputManager->getDispatcher()->setInputWindows(windowHandles, displayId);
// Do this after the dispatcher has updated the window handle state.
bool newPointerGesturesEnabled = true;
@@ -1446,10 +1447,10 @@
}
static void nativeSetInputWindows(JNIEnv* env, jclass /* clazz */,
- jlong ptr, jobjectArray windowHandleObjArray) {
+ jlong ptr, jobjectArray windowHandleObjArray, jint displayId) {
NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
- im->setInputWindows(env, windowHandleObjArray);
+ im->setInputWindows(env, windowHandleObjArray, displayId);
}
static void nativeSetFocusedApplication(JNIEnv* env, jclass /* clazz */,
@@ -1678,7 +1679,7 @@
(void*) nativeInjectInputEvent },
{ "nativeToggleCapsLock", "(JI)V",
(void*) nativeToggleCapsLock },
- { "nativeSetInputWindows", "(J[Lcom/android/server/input/InputWindowHandle;)V",
+ { "nativeSetInputWindows", "(J[Lcom/android/server/input/InputWindowHandle;I)V",
(void*) nativeSetInputWindows },
{ "nativeSetFocusedApplication", "(JLcom/android/server/input/InputApplicationHandle;)V",
(void*) nativeSetFocusedApplication },