Input devices configure on per-display basis (2/2)
While computing the new configuration values based on
display info and input devices, some input devices may be
associated with a specific display.
This patch would apply the right corresponding config from the input
devices which are associated with current display or no associated.
The virtual display will still follow default display.
Bug: 116767202
Test: atest WindowConfigurationTests
Test: atest inputflinger_tests
Test: atest ActivityManagerMultiDisplayTests
Change-Id: I1dbd6e07ab81b5018be7bdb8c71dd44f2036eb4a
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index 669ff2b..5e7ea05 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -234,6 +234,7 @@
private static native void nativeReloadPointerIcons(long ptr);
private static native void nativeSetCustomPointerIcon(long ptr, PointerIcon icon);
private static native void nativeSetPointerCapture(long ptr, boolean detached);
+ private static native boolean nativeCanDispatchToDisplay(long ptr, int deviceId, int displayId);
// Input event injection constants defined in InputDispatcher.h.
private static final int INPUT_EVENT_INJECTION_SUCCEEDED = 0;
@@ -1890,6 +1891,16 @@
return new String[0];
}
+ /**
+ * Gets if an input device could dispatch to the given display".
+ * @param deviceId The input device id.
+ * @param displayId The specific display id.
+ * @return True if the device could dispatch to the given display, false otherwise.
+ */
+ public boolean canDispatchToDisplay(int deviceId, int displayId) {
+ return nativeCanDispatchToDisplay(mPtr, deviceId, displayId);
+ }
+
// Native callback.
private int getKeyRepeatTimeout() {
return ViewConfiguration.getKeyRepeatTimeout();