GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - blad/android-event-playback: Android Automation Utility for `getevent` and `sendevent`.

BranchesTags
Open more actions menu

Latest commit

 

History

9 Commits
9 Commits

Folders and files

NameName
Last commit message
Last commit date
out
out
 
 
test
test
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
demo.gif
demo.gif
 
 
process_event_log.awk
process_event_log.awk
 
 
runWithInput
runWithInput
 
 

Repository files navigation

Android Event Playback

This repository contains scripts that convert event logs from Android's getevent utility into binary files that can be played back via the adb shell.

Demo Video

Running the Scripts

  1. Collect events from the device or emulator adb shell getevent -t > events.log
    • Note that the -t flag is required. It provides the script a way to calculate delays between events.
  2. Run the conversion script: ./runWithInput events.log
  3. Push the event files and coordinator script to the device: adb push out/* sdcard/android-event-playback/
  4. Run the playback script:
    adb shell "sh -c 'cd /sdcard/android-event-playback/ && sh ./run_events.sh'"
    
  • Repeat Step 4 to replay the events again and again.

  • Repeat Step 1-4 for any new event log or changes to the event log that you'd like to playback.

  • Note: Each device or emulator configuation may have vastly different event log outputs for similar events. Replaying event logs on a different device or emulator configuration is not expected to work. Event playback should work on identical device or emulator configuations.

Why this project exists:

This project is an experiment to better understand how the getevent and sendevent utilities work in Android.

After experimentation, sendevent it became clear that even after successfully exporting events via getevent, a couple issue became clear. First, it took reformatting the output of getevent to be able to play events back with sendevent. Second, sendevent seemed to lag when a large number of event like dragging occurred.

If you've encountered the second issue you'll note that the workaround suggested on sites like StackOverflow are to write to /dev/input/eventX directly. But this means that we've got to format the output of getevent into binary!

If you've gone as far as converting the events into binary, you've likely been rewarded with another issue: Events are played back too fast, causing events to be dropped or skipped all-together!

To get around this we need some sort of coordinator to delay the input of events into /dev/input/eventX. This project attempts to generate a coordinator script (run_events.sh) so that events are played back in a similar time span as the original events, but also tried to input events directly into /dev/input/eventX to avoid some of the slowness typically experienced.

May this experiment be helpful in your journey to automate the Android UI!

Requirements

  • awk: Specifically GAwk 4.x
  • xxd: Hexdump Utility
  • adb: Part of the Android SDK Platform Tools

About

Android Automation Utility for `getevent` and `sendevent`.

Topics

adbandroidautomation

Resources

Readme
MIT license
Activity

Stars

6 stars

Watchers

1 watching

Forks

3 forks
Report repository

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.