Commit 0ebb2ca4 authored by Isaac Murchie's avatar Isaac Murchie Committed by Commit Bot

[ChromeDriver] Fix Chromedriver functioning for Android O

In Android O "ps" only returns the user's processes (generally just the "ps"
command itself). Run both the bare "ps" command and with the flag "-A" to
handle Android O.

Move to using ps && ps -A for chromedriver process inspection

Bug: chromedriver:2013
Change-Id: I1cc667f2ec6ff9ac5363ad7f8d34614a16badf3b
Reviewed-on: https://chromium-review.googlesource.com/696163Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Commit-Queue: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505817}
parent 572430a1
...@@ -304,6 +304,7 @@ Ilia K <ki.stfu@gmail.com> ...@@ -304,6 +304,7 @@ Ilia K <ki.stfu@gmail.com>
Ilya Konstantinov <ilya.konstantinov@gmail.com> Ilya Konstantinov <ilya.konstantinov@gmail.com>
Ion Rosca <rosca@adobe.com> Ion Rosca <rosca@adobe.com>
Irmak Kavasoglu <irmakkavasoglu@gmail.com> Irmak Kavasoglu <irmakkavasoglu@gmail.com>
Isaac Murchie <murchieisaac@gmail.com>
Isaac Reilly <reillyi@amazon.com> Isaac Reilly <reillyi@amazon.com>
Ivan Sham <ivansham@amazon.com> Ivan Sham <ivansham@amazon.com>
J. Ryan Stinnett <jryans@chromium.org> J. Ryan Stinnett <jryans@chromium.org>
......
...@@ -206,7 +206,10 @@ Status AdbImpl::GetPidByName(const std::string& device_serial, ...@@ -206,7 +206,10 @@ Status AdbImpl::GetPidByName(const std::string& device_serial,
const std::string& process_name, const std::string& process_name,
int* pid) { int* pid) {
std::string response; std::string response;
Status status = ExecuteHostShellCommand(device_serial, "ps", &response); // on Android O `ps` returns only user processes, so also try with `-A` flag.
Status status = ExecuteHostShellCommand(device_serial, "ps && ps -A",
&response);
if (!status.IsOk()) if (!status.IsOk())
return status; return status;
...@@ -263,4 +266,3 @@ Status AdbImpl::ExecuteHostShellCommand( ...@@ -263,4 +266,3 @@ Status AdbImpl::ExecuteHostShellCommand(
"host:transport:" + device_serial + "|shell:" + shell_command, "host:transport:" + device_serial + "|shell:" + shell_command,
response); response);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment