Minimal multitouch event producer for Android.
This repository was superseded by https://github.com/DeviceFarmer/minitouch
Minitouch provides a socket interface for triggering multitouch events and gestures on Android devices. It works without root if started via ADB on at least SDK 25 and lower, though any version should work. The sole exception is SDK 20 (Android Wear), which does require root. The lowest SDK level we test is 10 (i.e. Android 2.3.3).
It works especially well with HTML5 multitouch events, and unlike the Android monkey tool, allows you to access the whole screen (including any software buttons).
Building requires NDK, and is known to work with at least with NDK Revision 10 (July 2014). Note that NDK 15 no longer supports anything below Android SDK level 14, meaning that binaries may or may not work on older devices (e.g. Android 2.3).
We include libevdev as a Git submodule, so first make sure you've fetched it.
git submodule init
git submodule updateThen it's simply a matter of invoking ndk-build.
ndk-buildYou should now have the binaries available in ./libs.
You'll need to build first.
Minitouch can't handle Android 10 by default, due to a new security policy. The workaround is to forward touch commands to STFService. If you are using minicap standalone (without STF), you need to take care of running the service and agent, before running minicap. Instructions on how to do that can be found here.
You can then use the included run.sh script to run the right binary on your device. If you have multiple devices connected, set ANDROID_SERIAL before running the script.
To run manually, you have to first figure out which ABI your device supports:
ABI=$(adb shell getprop ro.product.cpu.abi | tr -d '\r')Note that as Android shell always ends lines with CRLF, you'll have to remove the CR like above or the rest of the commands will not work properly.
Also note that if you've got multiple devices connected, setting $ANDROID_SERIAL will make things quite a bit easier as you won't have to specify the -s option every time.
Now, push the appropriate binary to the device:
adb push libs/$ABI/minitouch /data/local/tmp/Note that for SDK ] [-n ] [-v] [-i] [-f ] -d : Use the given touch device. Otherwise autodetect. -n : Change the name of of the abtract unix domain socket. (minitouch) -v: Verbose output. -i: Uses STDIN and doesn't start socket. -f : Runs a file with a list of commands, doesn't start socket. -h: Show help.
So, we can simply run the binary without any options, and it will try to detect an appropriate device and start listening on an abstract unix domain socket. Alternatively, you can start minitouch with the `-i` option and input commands directly via standard input, or `-f ` to read commands from a file.
```bash
adb shell /data/local/tmp/minitouch
```
If you chose to use a socket, you need to connect to it separately. Unless there was an error message and the binary exited, we should now have a server open on the device. Now we simply need to create a local forward so that we can connect to it.
```bash
adb forward tcp:1111 localabstract:minitouch
```
Now you can connect to the socket using the local port. Note that currently **only one connection at a time is supported.** This is mainly because it would otherwise be too easy to submit broken event streams, confusing the driver and possibly freezing the device until a reboot (which, by the way, you'd most likely have to do with `adb reboot` due to the unresponsive screen). Anyway, let's connect.
```bash
nc localhost 1111
```
…
```
d 0 10 10 50
c
u 0
c
```
Long tap on (10, 10) with 50 pressure using a single contact.
```
d 0 10 10 50
c
u 0
c
```
Tap on (10, 10) and (20, 20) simultaneously with 50 pressure using two contacts.
```
d 0 10 10 50
d 1 20 20 50
c
u 0
u 1
c
```
Tap on (10, 10), keep it pressed, then after a while also tap on (20, 20), keep it pressed, then release the first contact and finally release the second contact.
```
d 0 10 10 50
c
d 1 20 20 50
c
u 0
c
u 1
c
```
Swipe from (0, 0) to (100, 0) using a single contact. You'll need to wait between commits in your own code to slow it down.
```
d 0 0 0 50
c
m 0 20 0 50
c
m 0 40 0 50
c
m 0 60 0 50
c
m 0 80 0 50
c
m 0 100 0 50
c
u 0
c
```
Pinch with two contacts going from (0, 100) to (50, 50) and (100, 0) to (50, 50). You'll need to wait between commits in your own code to slow it down.
```
d 0 0 100 50
d 1 100 0 50
c
m 0 10 90 50
m 1 90 10 50
c
m 0 20 80 50
m 1 80 20 50
c
m 0 20 80 50
m 1 80 20 50
c
m 0 30 70 50
m 1 70 30 50
c
m 0 40 60 50
m 1 60 40 50
c
m 0 50 50 50
m 1 50 50 50
c
u 0
u 1
c
```
The same pinch but with more chaotic (or natural) ordering.
```
d 1 100 0 50
c
d 0 0 100 50
c
m 1 90 10 50
m 0 10 90 50
c
m 0 20 80 50
c
m 1 80 20 50
c
m 0 20 80 50
m 1 80 20 50
c
m 0 30 70 50
c
m 1 70 30 50
c
m 1 60 40 50
c
m 0 40 60 50
c
m 0 50 50 50
m 1 50 50 50
c
u 0
c
u 1
c
```
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md).
## License
See [LICENSE](LICENSE).
Copyright © CyberAgent, Inc. All Rights Reserved.No open issues yet, or sync has not completed.