Fix flaky rotary tests

Set FLAG_RETRIEVE_INTERACTIVE_WINDOWS flag so UiAutomation can
reliably access the root node in the active window.

Supress system window tests which relied on the tests not having
permission to create AccessibilityWindowInfos.

Make RotaryService not throw an exception when it has no base
context, as is the case during tests.

Test: atest CarRotaryControllerUnitTests
Bug: 194717628
Change-Id: I04b3b16e87866d6abf2f8fdc2782f10871b102c2
4 files changed
tree: 5378292e2c525528514ccaf35045ed9219bb997d
  1. proto/
  2. res/
  3. src/
  4. tests/
  5. tools/
  6. .gitignore
  7. Android.bp
  8. AndroidManifest.xml
  9. OWNERS
  10. PREUPLOAD.cfg
  11. readme.md
  12. TEST_MAPPING
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