Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Unknown command: tap #35

Open
ghazel opened this issue Jan 20, 2017 · 10 comments
Open

Error: Unknown command: tap #35

ghazel opened this issue Jan 20, 2017 · 10 comments

Comments

@ghazel
Copy link

ghazel commented Jan 20, 2017

Running on the Nexus Q

16:53:40 [INFO ] [AbstractApplicationContext] - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@28ba21f3: startup date [Thu Jan 19 16:53:40 PST 2017]; root of context hierarchy
16:53:46 [WARN ] [AutowiredAnnotationBeanPostProcessor] - Inconsistent constructor declaration on bean with name 'androidDeviceImpl': single autowire-marked constructor flagged as optional - this constructor is effectively required since there is no default constructor to fall back to: public com.github.xsavikx.androidscreencast.api.AndroidDeviceImpl(com.android.ddmlib.IDevice)
Error: Unknown command: tap
usage: input [text|keyevent]
input text <string>
input keyevent <event_code>
@xSAVIKx
Copy link
Owner

xSAVIKx commented Jan 20, 2017 via email

@ghazel
Copy link
Author

ghazel commented Sep 24, 2017

Using monkeyrunner to emit a touch event works:

>>> from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
>>> device = MonkeyRunner.waitForConnection()
>>> device.touch(512, 1800, MonkeyDevice.DOWN_AND_UP)     

@xSAVIKx
Copy link
Owner

xSAVIKx commented Sep 24, 2017

@ghazel probably it emits 2 keyevent commands and that's why it's possible to send tap event.

I'd appreciate a PR with such fallback functionality when direct ADB tap command is not available.

@ghazel
Copy link
Author

ghazel commented Jan 5, 2018

I don't see it using keyevent commands. It's using the monkey tcp interface (https://github.com/aosp-mirror/platform_development/blob/master/cmds/monkey/README.NETWORK.txt) and sending:
tap x y

@xSAVIKx
Copy link
Owner

xSAVIKx commented Jan 9, 2018

@ghazel try to run adb shell input tap 512 1800 within the terminal. Also, what adb instance do you use?

@ghazel
Copy link
Author

ghazel commented Jan 9, 2018

input on the device does not have a tap command. The adb is the one that comes with platform-tools.

@xSAVIKx
Copy link
Owner

xSAVIKx commented Jan 10, 2018

@ghazel OK. So, tap ins't supported by your input implementation.

Monkey uses its own implementation of the tap command:

tap x y
The tap command is a shortcut for the touch command.  It will
automatically send both the up and the down event.

And the tap is just a shortcut to the touch:

touch [down|up|move] x y

This command injects a MotionEvent into the input system that
simulates a user touching the touchscreen (or a pointer event).  x and
y specify coordinates on the display (0 0 being the upper left) for
the touch event to happen.  Just like key events, touch events at a
single location require both a down and an up.  To simulate dragging,
send a "touch down", then a series of "touch move" events (to simulate
the drag), followed by a "touch up" at the final location.

Anyway, Monkey uses their own implementation of events, that rely on android.hardware.input.InputManager. That means, that we do need some client on the device side, while AndroidScreencast doesn't required any client side app.

For now, I don't know how to help you. The only possible way here I see — implement some fallback with input keyevent when tap isn't available.

@ghazel
Copy link
Author

ghazel commented Jan 10, 2018

AndroidScreencast does require the input command on the client side, same as monkey. It's just that in my case monkey works better than input. They both seem to be present on all devices.

@Hattshire
Copy link

given we use adb to do this, it would be better for a broader compatibility to push an executable(i.e. modified input ) with adb to a temp folder and execute that instead of the native device executable.

@xSAVIKx
Copy link
Owner

xSAVIKx commented Feb 20, 2018

@Hattshire I do appreciate a PR with such modifications :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants