Closed peterdk closed 4 years ago
Should fix #12 and #6
In my phone, it works the other way around... If I replace shell
with exect-out
it stops working and hangs at the end of playback.
Do you think this depends on the Android version?
Ok, frustrating. I am running the command from OSX, maybe that is the issue? I will check on Ubuntu to see if I can replicate your behaviour.
I assume you are displaying the recorded .txt file in your screenshot?
Yes, I am using Ubuntu, which version of adb
is the default one in OS?
Yes that is the .txt file
We could use the following:
if [[ "$OSTYPE" == "linux-gnu" ]]; then
adb shell getevent -t "${TOUCH_DEVICE#*-> }" > recorded_touch_events.txt
else
#exec-out is shell without buffering, fixing missing last touch data event
adb exec-out getevent -t "${TOUCH_DEVICE#*-> }" > recorded_touch_events.txt
fi
It will work fine on both.
I tried on Ubuntu 18.04, and with shell I get half end line, and with exec-out I get full last line. So unfortunately itś not due to OSX. ADB on Ubuntu is: Android Debug Bridge version 1.0.39 Version 1:8.1.0+r23-5
I am using a Android 9 phone.
Ok, it must have to do with the Android version, my phone is using version 6.0
... very old! I think expect-out
was only introduced in 5.0
so it may be that my phone does not have it yet. Let me see if there is a way to check for the Android version if <= 6.0
we use the shell
.
I tested with a 6.0, 7.0 and a 7.1 emulator and can indeed reproduce. On 6.0 shell gives full lines, and exec-out cut off lines. On 7.0 and higher it's reversed.
perfect! I just added a condition check in the file, if the version <=
6.0 then it uses the shell
Nice
It should be working fine now! Thank you!
Maybe it's easier to use the sdk int? ro.build.version.sdk
is it dependent on the SDK or on the Android version?
SDK int is same indicator as Android version, only in simple int instead of a more complex float like number.
https://source.android.com/setup/start/build-numbers
So 24 and higher should use exec-out
Ok, I will fix it then
done! :+1:
Ok, great!
Can't it be simplified to: if ((ANDROID_VERSION > MIN_VERSION)) ? I am not a bash expert, but it looks a bit too complicated now since we only use simpel ints.
done
A simple fix to make recording working as it should: capturing all data. When using
shell
there is some buffering at play which causes the last touch events not being fully recorded resulting in weird hanging touch at the end of playback.exec-out
isshell
without buffering.