How to make a double tap to expand the video scree

2019-09-04 03:57发布

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!

1条回答
ゆ 、 Hurt°
2楼-- · 2019-09-04 04:30

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"
查看更多
登录 后发表回答