commit | a8b3d847308701fa686a6aa3d1dbb602ab6ec06c | [log] [tgz] |
---|---|---|
author | Danny Epstein <depstein@google.com> | Wed Oct 21 17:49:15 2020 -0700 |
committer | Danny Epstein <depstein@google.com> | Fri Nov 06 21:39:07 2020 +0000 |
tree | 7b3ce3db32a8035182c8cbe91adfd538472413ac | |
parent | 38f532c8944c2f74e44eac5fc8031ba6c12122c0 [diff] |
Handle fast rotation and nudging When the user rotates quickly, the TYPE_VIEW_FOCUSED events for the focus changes can arrive after the focus has already moved. If the event is for a view which has since scrolled off the screen, its source will be null. In order to handle fast rotation, RotaryService must update mFocusedNode when performing ACTION_FOCUS rather than relying on the subsequent TYPE_VIEW_FOCUSED event. When performing an action that changes the focus in a way which can't be predicted ahead of time, e.g. performing ACTION_FOCUS on a FocusArea, find the focus immediately afterward rather than waiting for the TYPE_VIEW_FOCUSED event. In order to determine whether mFocusedNode should be updated for each TYPE_VIEW_FOCUSED events, keep track of the last node focused by the RotaryService, whether by performing ACTION_FOCUS on it or by performing an action which changes the focus unpredictably as described above, until the corresponding event is received. This is sufficient to distinguish between externally triggered events, which should set mFocusedNode, and self-triggered events, which shouldn't. Test: rotate quickly with occasional nudges on emulator and Seahawk Bug: 169886834 Change-Id: Ic35bbb448e315de9b5e9e4b0ddcf8be2bcb44b30
make CarRotaryController -j64
To enable, run:
adb shell settings put secure enabled_accessibility_services com.android.car.rotary/com.android.car.rotary.RotaryService
To disable, run:
adb shell settings delete secure enabled_accessibility_services
To rotate the controller counter-clockwise, run:
adb shell cmd car_service inject-rotary
For clockwise, run:
adb shell cmd car_service inject-rotary -c true
To rotate the controller multiple times (100 ms ago and 50 ms ago), run:
adb shell cmd car_service inject-rotary -dt 100 50
To nudge the controller up, run:
adb shell cmd car_service inject-key 280
Use KeyCode 280
for nudge up, 281
for nudge down,282
for nudge left,283
for nudge right.
To click the controller center button, run:
adb shell cmd car_service inject-key 23