Loading services/core/java/com/android/server/input/InputManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,7 @@ public class InputManagerService extends IInputManager.Stub 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; Loading Loading @@ -1890,6 +1891,16 @@ public class InputManagerService extends IInputManager.Stub 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(); Loading services/core/java/com/android/server/wm/DisplayContent.java +33 −26 Original line number Diff line number Diff line Loading @@ -1665,16 +1665,24 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo final int len = devices != null ? devices.length : 0; for (int i = 0; i < len; i++) { InputDevice device = devices[i]; if (!device.isVirtual()) { // Ignore virtual input device. if (device.isVirtual()) { continue; } // Check if input device can dispatch events to current display. // If display type is virtual, will follow the default display. if (!mWmService.mInputManager.canDispatchToDisplay(device.getId(), displayInfo.type == Display.TYPE_VIRTUAL ? DEFAULT_DISPLAY : mDisplayId)) { continue; } final int sources = device.getSources(); final int presenceFlag = device.isExternal() ? WindowManagerPolicy.PRESENCE_EXTERNAL : WindowManagerPolicy.PRESENCE_INTERNAL; final int presenceFlag = device.isExternal() ? WindowManagerPolicy.PRESENCE_EXTERNAL : WindowManagerPolicy.PRESENCE_INTERNAL; // TODO(multi-display): Configure on per-display basis. if (mWmService.mIsTouchDevice) { if ((sources & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN) { if ((sources & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN) { config.touchscreen = Configuration.TOUCHSCREEN_FINGER; } } else { Loading @@ -1695,7 +1703,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo keyboardPresence |= presenceFlag; } } } if (config.navigation == Configuration.NAVIGATION_NONAV && mWmService.mHasPermanentDpad) { config.navigation = Configuration.NAVIGATION_DPAD; Loading services/core/jni/com_android_server_input_InputManagerService.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -1652,6 +1652,13 @@ static void nativeSetCustomPointerIcon(JNIEnv* env, jclass /* clazz */, im->setCustomPointerIcon(spriteIcon); } static jboolean nativeCanDispatchToDisplay(JNIEnv* env, jclass /* clazz */, jlong ptr, jint deviceId, jint displayId) { NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); return im->getInputManager()->getReader()->canDispatchToDisplay(deviceId, displayId); } // ---------------------------------------------------------------------------- static const JNINativeMethod gInputManagerMethods[] = { Loading Loading @@ -1726,6 +1733,8 @@ static const JNINativeMethod gInputManagerMethods[] = { (void*) nativeReloadPointerIcons }, { "nativeSetCustomPointerIcon", "(JLandroid/view/PointerIcon;)V", (void*) nativeSetCustomPointerIcon }, { "nativeCanDispatchToDisplay", "(JII)Z", (void*) nativeCanDispatchToDisplay }, }; #define FIND_CLASS(var, className) \ Loading Loading
services/core/java/com/android/server/input/InputManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,7 @@ public class InputManagerService extends IInputManager.Stub 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; Loading Loading @@ -1890,6 +1891,16 @@ public class InputManagerService extends IInputManager.Stub 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(); Loading
services/core/java/com/android/server/wm/DisplayContent.java +33 −26 Original line number Diff line number Diff line Loading @@ -1665,16 +1665,24 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo final int len = devices != null ? devices.length : 0; for (int i = 0; i < len; i++) { InputDevice device = devices[i]; if (!device.isVirtual()) { // Ignore virtual input device. if (device.isVirtual()) { continue; } // Check if input device can dispatch events to current display. // If display type is virtual, will follow the default display. if (!mWmService.mInputManager.canDispatchToDisplay(device.getId(), displayInfo.type == Display.TYPE_VIRTUAL ? DEFAULT_DISPLAY : mDisplayId)) { continue; } final int sources = device.getSources(); final int presenceFlag = device.isExternal() ? WindowManagerPolicy.PRESENCE_EXTERNAL : WindowManagerPolicy.PRESENCE_INTERNAL; final int presenceFlag = device.isExternal() ? WindowManagerPolicy.PRESENCE_EXTERNAL : WindowManagerPolicy.PRESENCE_INTERNAL; // TODO(multi-display): Configure on per-display basis. if (mWmService.mIsTouchDevice) { if ((sources & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN) { if ((sources & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN) { config.touchscreen = Configuration.TOUCHSCREEN_FINGER; } } else { Loading @@ -1695,7 +1703,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo keyboardPresence |= presenceFlag; } } } if (config.navigation == Configuration.NAVIGATION_NONAV && mWmService.mHasPermanentDpad) { config.navigation = Configuration.NAVIGATION_DPAD; Loading
services/core/jni/com_android_server_input_InputManagerService.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -1652,6 +1652,13 @@ static void nativeSetCustomPointerIcon(JNIEnv* env, jclass /* clazz */, im->setCustomPointerIcon(spriteIcon); } static jboolean nativeCanDispatchToDisplay(JNIEnv* env, jclass /* clazz */, jlong ptr, jint deviceId, jint displayId) { NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); return im->getInputManager()->getReader()->canDispatchToDisplay(deviceId, displayId); } // ---------------------------------------------------------------------------- static const JNINativeMethod gInputManagerMethods[] = { Loading Loading @@ -1726,6 +1733,8 @@ static const JNINativeMethod gInputManagerMethods[] = { (void*) nativeReloadPointerIcons }, { "nativeSetCustomPointerIcon", "(JLandroid/view/PointerIcon;)V", (void*) nativeSetCustomPointerIcon }, { "nativeCanDispatchToDisplay", "(JII)Z", (void*) nativeCanDispatchToDisplay }, }; #define FIND_CLASS(var, className) \ Loading