mobly icon indicating copy to clipboard operation
mobly copied to clipboard

A better way to accommodate custom adb calls

Open xpconanfan opened this issue 7 years ago • 6 comments

This came up in a discussion with @winterfroststrom

The AdbProxy was designed for the most straightforward use cases, like adb.shell('getprop') - simple call and return.

This does not work well if users want to have more control of the call. E.g. process the live streaming of the stdout of the call subprocess.

We might want to consider providing a new adb interface for users who want to make long-running calls and have more control of the subprocess.

xpconanfan avatar May 11 '18 15:05 xpconanfan

This issue looks interesting to me. I can work on this issue if granted and this is still a valid issue. Thanks!

johnklee avatar May 11 '21 01:05 johnklee

This has not come up a lot recently, so it has not been a priority. I'm thinking maybe a logcat service pub-sub mechanism is probably good enough for most users.

What idea do you have in mind for the adb level API? Can you share some high level examples? :)

xpconanfan avatar May 15 '21 06:05 xpconanfan

Thanks for your attention! It all depends on the requirements we have. e.g.:

This does not work well if users want to have more control of the call.
E.g. process the live streaming of the stdout of the call subprocess.

We might want to consider providing a new adb interface for users who want to make long-running calls and have more control of the subprocess.

If I can have more information about the discussion you had with @winterfroststrom so to learn more about details about requirements and your expectation on the result of this issue, then I can come up with a high-level proposal on API design for your review. Again, thanks for your asking and look forward to making a contribution to this repo.

johnklee avatar May 15 '21 10:05 johnklee

I see.

So basically, there is no good support for non-blocking long running adb commands today. E.g. the adb logcat service has to use a raw start_standing_process call, and manage the process directly, in addition to handling the stdout and stderr.

So the idea for this request is to create a mid-layer between raw process management and AndroidDevice services for adb commands.

xpconanfan avatar May 17 '21 02:05 xpconanfan

Understood!

Let me study some existing packages such as invoke, python-shell, pexpect and python-rrmngmnt to see if there is anything we can learn from them and then will propose a design document (module with API usage) for your review. Thanks!

johnklee avatar May 18 '21 00:05 johnklee

Hi,

I made up slides as the proposal for this issue. Please check this link:

  • P2: Description of this issue
  • P3-6: The study of the original implementation
  • P7-8: The proposal for this issue.

Any advice and feedback are appreciated. Sorry for the late response and look forward to your lesson. Many thanks!

johnklee avatar May 28 '21 10:05 johnklee