Refactor RotaryService and Navigator

1. Update handleViewFocusedEvent(). The focus will be adjusted properly
by the framework due to a recent change, so RotaryService doesn't need
to adjust the focus any more. As a result, PendingFocusedNodes class is
not needed any more.
2. Remove RotaryCache since the history is kept in FocusArea class due
to a recent change.
3. Due to a recent change, the nudge target finding is mostly done on
the app side. So update the logic in RotaryService accordingly.
4. Remove failing roboletric tests. Since roboletric tests are being
deprecated, don't bother updating them to make them pass. Equivalent
instrumented tests will be added later.
5. Replace NodePredicate with Predicate in Java library.

Bug: 168844996
Bug: 170344916
Test: atest CarRotaryControllerRoboTests, and manual test
Change-Id: Ib3199df71da625f5dd907f23bc6b8625a121ca36
Merged-In: Ib3199df71da625f5dd907f23bc6b8625a121ca36
12 files changed
tree: 85f86bb79ee74ca7e6089f1a9a3cff753a41f7c4
  1. res/
  2. src/
  3. tests/
  4. Android.bp
  5. AndroidManifest.xml
  6. OWNERS
  7. readme.md
readme.md

Car rotary service

Building

make CarRotaryController -j64

Enable/disable RotaryService

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

Inject events

Inject RotaryEvent

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

Inject KeyEvent

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