appetizerio / replaykit

[DEPRECATED] Command line tools for recording, replaying and mirroring touchscreen events for Android
Apache License 2.0
245 stars 61 forks source link

Error replaying on Android8 for Oneplus and Samsung S8 #22

Open syberkitten opened 5 years ago

syberkitten commented 5 years ago

Hi Great project, but I have some bugs with certain devices, not all events are recorded, and I'm getting this error in stderr:

[stderr_data]:  /var/folders/t7/wykzbl_x2gqb4yx6l_fz04zh0000gn/T/_MEIBUqnr0/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(989318.934083, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 10)
/var/folders/t7/wykzbl_x2gqb4yx6l_fz04zh0000gn/T/_MEIBUqnr0/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(989318.942262, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 8)

[stderr_data]:  /var/folders/t7/wykzbl_x2gqb4yx6l_fz04zh0000gn/T/_MEIBUqnr0/droidrep/GeteventTools.py:179: UserWarning: TypeB MT meets unknown evCmd(989318.949994, 'EV_KEY', 'BTN_TOOL_FINGER', 0)

[stderr_data]:  /var/folders/t7/wykzbl_x2gqb4yx6l_fz04zh0000gn/T/_MEIBUqnr0/droidrep/GeteventTools.py:179: UserWarning: TypeB MT meets unknown evCmd(989319.074845, 'EV_KEY', 'BTN_TOOL_FINGER', 1)

[stderr_data]:  /var/folders/t7/wykzbl_x2gqb4yx6l_fz04zh0000gn/T/_MEIBUqnr0/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(989319.074845, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 11)

[stderr_data]:  /var/folders/t7/wykzbl_x2gqb4yx6l_fz04zh0000gn/T/_MEIBUqnr0/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(989319.099495, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 10)

the side effect is that when pressing the same button lets say: 10 times only the first 1-2-3 are recorded.

Once the above error comes, not all events are recorded.

Happens mainly on devices having android >= 8 such as OnePlus 6 / Xiaomi Mi 5 / etc....

On the Xiaomi when trying to record I get:

[stderr_data]:  The Linux device file for touchscreen cannot be auto-detected. The device might not have proper permissions for getevent

When trying to play getting:

[stdout_line]:  Crash in main_thread
mingyuan-xia commented 5 years ago

These ignored TypeB unknown commands should be benign, but worth a careful look. As for the crash, I will find a Oneplus device to test with. [stderr_data]: The Linux device file for touchscreen cannot be auto-detected. The device might not have proper permissions for getevent This is more likely the root cause for this case. On Mi5, please turn on USB debugging (Security option) in the developer options and try record again. If the problem still happens, please let me know.

syberkitten commented 5 years ago

Haven't been able to find this file mentioned: droidrep/GeteventTools.py:172

Looks like only part of the directory structure exists, but the file is missing.

mingyuan-xia commented 5 years ago

That is just a pointer to the source file line number in the compiled python executable. Please have a try on Mi5 with USB debugging (Security option) on while I am taking a look at the Oneplus.

syberkitten commented 5 years ago

I've been trying with Galaxy S8, what happens is that when trying to play events, a small cursor appears on the screen and starts to move.

This is happening instead of the actual events being played, a small cursor us being played.

Did you notice this issue? (Android version 8.0.0) Samsung experience version: 9.0

here's a link to see video of playback: https://drive.google.com/open?id=1khyK87ZA5vpkcm1nyuuP7dssetJFKBpg

mingyuan-xia commented 5 years ago

This is weird. But the mouse cursor seems to replay the finger gestures properly. I guess it is because S8 supports a Stylus Pen and the touchscreen events being replayed were mistaken as from the pen. Anyway, thanks for the video it is very helpful.

syberkitten commented 5 years ago

@mingyuan-xia Thanks for having a look, I've just recorded and played events on the Xiaomi Mi 5 after unlocking it for this feature.

Events are playing, I'm still getting these errors, but at least most of the playback looks ok.

I'll do some more testing and update.

[stderr_data]:  /var/folders/t7/wykzbl_x2gqb4yx6l_fz04zh0000gn/T/_MEIk2J53g/droidrep/GeteventTools.py:179: UserWarning: TypeB MT meets unknown evCmd(53257.220341, 'EV_KEY', 'BTN_TOOL_FINGER', 1)

[stderr_data]:  /var/folders/t7/wykzbl_x2gqb4yx6l_fz04zh0000gn/T/_MEIk2J53g/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(53257.220341, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 4)
syberkitten commented 5 years ago

Some observations, most of the time when recording events and playing, the last events are skipped. (last 0.5 seconds approximately)

it's as if not all events are played, or you need to add some delay before last events are loaded and the exit to appetizer shell.

did you notice this issue? It's happening with all devices.

mingyuan-xia commented 5 years ago

yes, this bug has bothered me for a while. https://github.com/appetizerio/replaykit/issues/5 also reported. I know about why it happens, but workarounds are not easy. I think I will fix this one first before the device compatibility issues.

syberkitten commented 5 years ago

Good to hear it's a known issue. My workaround is to simply record a few more "dummy" events at the end.

and looking forward to your next (upcoming) release 👍

connglli commented 4 years ago

When record, replaykit still complains about UserWarning: TypeB MT meets unknown evCmd(...) on OnePlus 6T (with Android 9).

> ./replaykit trace record mytrace.trace
appetizer> /tmp/_MEIFNxiKl/droidrep/GeteventTools.py:179: UserWarning: TypeB MT meets unknown evCmd(66131.628426, 'EV_KEY', 'BTN_TOOL_FINGER', 1)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(66131.628426, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 7)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(66131.638401, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 8)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(66131.663978, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 7)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(66131.680905, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 6)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:179: UserWarning: TypeB MT meets unknown evCmd(66131.697122, 'EV_KEY', 'BTN_TOOL_FINGER', 0)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:179: UserWarning: TypeB MT meets unknown evCmd(66132.809589, 'EV_KEY', 'BTN_TOOL_FINGER', 1)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(66132.848911, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 5)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:179: UserWarning: TypeB MT meets unknown evCmd(66132.865154, 'EV_KEY', 'BTN_TOOL_FINGER', 0)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:179: UserWarning: TypeB MT meets unknown evCmd(66134.301622, 'EV_KEY', 'BTN_TOOL_FINGER', 1)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(66134.301622, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 10)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(66134.321209, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 11)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:172: UserWarning: Type B MT meets unknown evCmd(66134.329474, 'EV_ABS', 'ABS_MT_TOUCH_MINOR', 10)
/tmp/_MEIFNxiKl/droidrep/GeteventTools.py:179: UserWarning: TypeB MT meets unknown evCmd(66134.337349, 'EV_KEY', 'BTN_TOOL_FINGER', 0)

When replay, replaykit complains about Error while communicating with adb server(127.0.0.1:5037): Fail to get enough bytes, even though adb server is already started (see below)

> adb devices
List of devices attached
df3ba3cf        device

> ./replaykit trace replay mytrace.trace df3ba3cf
Error while communicating with adb server(127.0.0.1:5037): Fail to get enough bytes

> adb kill-server
> adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully

> ./replaykit trace replay mytrace.trace df3ba3cf
Error while communicating with adb server(127.0.0.1:5037): Fail to get enough bytes