1

I am trying to analyze a streaming video in my Android device. I want everything automated by scripts, because the device has to repeat the test a lot of times and I want to do it remotely (it is LAN connected). For that, I am using a special app, which starts to stream the video on a small-sized screen (it is special for that, I must expand the screen and I must use only this android app). A double-tap should be made to expand the screen (there is no button to expand, I can do it only double-tapping manually).

Due to my automation, I am trying to expand the video screen from a batch file when the video is streaming executing the following:

adb shell input tap x1 y1

adb shell input tap x1 y1

But it does not work. I've tried also with input touchscreen, input swipe x1 y1 x1 y1, I put every combination in a infinite loop, and it never expands. Maybe because the double tap it is too slow.... or maybe because that event needs to send a tap-release event.

Anybody encountered this problem already? How could I do a double tap to expand the screen remotely?

Thank you for your time!

Jon O
  • 6,532
  • 1
  • 46
  • 57
  • Please try this, If it work, will post complete solution. 1. Save [this](http://pastebin.com/Q1YkcEdn) script as `double_tap.sh` 2.Transfer to device `adb push double_tap.sh /sdcard/` 3. Run this Script `adb shell sh /sdcard/double_tap.sh`. Should work as double tap. – Saurabh Meshram Sep 16 '14 at 10:11
  • Forgot to mention, Please run this script only when the Video is on the screen, waiting for a double-tap input from user in order to expand the screen. – Saurabh Meshram Sep 16 '14 at 11:30
  • Hello Saurabh, first of all, thanks for replying. I am trying it right now. With that script, you are trying to double_tap to x = 458 and y = 86, right? I only have to change the coordinates to tap on the video screen. I am going to test it, event2 in your script corresponds to sec_touchkey in my device (typing adb shell getevent). I tell you in few minutes. Please confirm if the coordinates are placed at the line 3 and line 4 in your script. Many thanks! – Jesús Fidel Fraile Sep 16 '14 at 11:37
  • It does not work. It is showing the following: not foundble_tap.sh[1]: : not foundble_tap.sh[5]: : not foundble_tap.sh[20]: : not foundble_tap.sh[21]: – Jesús Fidel Fraile Sep 16 '14 at 11:43
  • It did work for me, The exact procedure you may need to follow : [Here](http://stackoverflow.com/questions/25363526/fire-a-pinch-in-out-command-to-android-phone-using-adb/25629952#25629952) , Though the objecive was different here, The approach will be the same. Is your script name `foundble_tap.sh` ? – Saurabh Meshram Sep 16 '14 at 11:47
  • I named it double_tap.sh, as yours. It was strange for me to see foundable_tap.sh as well. I checked it with ls and it is double_tap.sh. I will try it with that link. Could you please tell me where exactly are you trying to tap (x and y coordinates)in your double_tap.sh? I need to double tap on (x=800,y=540) – Jesús Fidel Fraile Sep 16 '14 at 11:57
  • As you see in the answer link, Basically just recording the events using `getevent` and playing it back using `sendevent`. So while you record make sure you tap on your desired coordinates `(x=800,y=540)` to reproduce the same output. I have given random coordinates while recording (using `getevent`). – Saurabh Meshram Sep 16 '14 at 12:09

1 Answers1

4

Finally I got it. First I've recorded the double-tap event and stored it into a binary file:

adb shell 
cd /sdcard/
cat /dev/input/event_X > doubletap

Do the doubletap wherever you want it, and then, end the recording with CTRL+C

The event_X is the event called sec_touchscreen. It can be got from:

adb shell getevent -p

Then, you can replay the doubletap with:

adb shell "cat /sdcard/doubletap > /dev/input/event_X"

In my case, it was tricky because it did not work executing once the replay, but two, like:

adb shell "cat /mnt/sdcard/doubletap > /dev/input/event_X"

adb shell "cat /mnt/sdcard/doubletap > /dev/input/event_X"
venkatvb
  • 681
  • 1
  • 9
  • 24