Create InputDevice ViewBehavior
ViewBehavior will be a static inner class for InputDevice, providing View-related behaviors pertaining to an InputDevice. We have added an API in InputDevice to return its ViewBehavior. This will be helpful if different InputDevice properties affect the way an input- generated MotionEvent should be handled by a View. For example, we have implemented a "shouldSmoothScroll" API in this change. This API is to tell Views processing motions generated by the InputDevice to prefer animating scrolls caused by such motions, to deliver a better quality scrolling UX than compared to a regular scroll that jumps by X pixels in a single frame. Note that, a single ViewBehavior instance contains all behaviors for a single InputDevice. This is unlike the other inner static class of InputDevice: MotionRange. This decision of making a single ViewBehavior contain all behaviors is made because not all View behaviors may depend on source+axis (e.g. there could be a behavior that is globally applicable to the whole InputDevice). Bug: 246946631 Test: unit tests, manual Change-Id: I65cf7d6556e26d199c9021f53bdae183f21d3c6d
Showing
- core/api/current.txt 5 additions, 0 deletionscore/api/current.txt
- core/java/android/hardware/input/InputManager.java 19 additions, 0 deletionscore/java/android/hardware/input/InputManager.java
- core/java/android/view/InputDevice.java 120 additions, 0 deletionscore/java/android/view/InputDevice.java
- core/jni/android_view_InputDevice.cpp 18 additions, 4 deletionscore/jni/android_view_InputDevice.cpp
- tests/Input/src/com/android/test/input/InputDeviceTest.java 10 additions, 3 deletionstests/Input/src/com/android/test/input/InputDeviceTest.java
Loading
Please register or sign in to comment