ya-webadb icon indicating copy to clipboard operation
ya-webadb copied to clipboard

[Scrcpy] wait for response when setting device clipboard

Open yume-chan opened this issue 2 months ago • 0 comments

Pre-issue checklist

  • [X] I've searched the issue list but couldn't find the feature I want

How can Tango be improved?

Added in Scrcpy v1.21, the server sends an acknowledge packet after successfully setting device clipboard.

https://docs.tangoapp.dev/scrcpy/versions/#v121-23

Tango can provide a built-in API to wait for the acknowledgement, rather than requiring the developer to use AdbScrcpyClient#deviceMessageStream

How should the API change?

  1. Move ScrcpyDeviceMessageDeserializeStream into ScrcpyOptions, allowing the options class to handle device messages according to their versions.
  2. Add setClipboard to ScrcpyOptions, allowing options classes to have complete control.
  3. Add a new type parameter TDeviceMessages to ScrcpyOptions, allowing ScrcpyOptions (and AdbScrcpyClient#deviceMessageStream to have different types for each version.

(Optional) Other information

When I was adding virtual displays to Scrcpy, I sent a device message to the client with the newly created display ID, so the client can launch apps (and do other things) on the display. Except, the current architecture doesn't allow me to add such device message into AdbScrcpyClient#deviceMessageStream, so I ended printing the display ID into stdout. This change can also fulfill this requirement.

yume-chan avatar Apr 08 '24 07:04 yume-chan