ya-webadb
ya-webadb copied to clipboard
[Scrcpy] wait for response when setting device clipboard
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?
- Move
ScrcpyDeviceMessageDeserializeStream
intoScrcpyOptions
, allowing the options class to handle device messages according to their versions. - Add
setClipboard
toScrcpyOptions
, allowing options classes to have complete control. - Add a new type parameter
TDeviceMessages
toScrcpyOptions
, allowingScrcpyOptions
(andAdbScrcpyClient#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.