Commit 6cfc5fcd authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

WebView Tools: fix issue when processes match substring

The record_netlog.py previously had a false positive when the package of
interest was a substring of a running process (ex. "com.foo" and there's
a process named "com.foo.persistent"). Substring matching was not
intended, so switch to GetApplicationPids() which does not perform
substring matches.

Searching for exact package names usually suffices (and this is just a
best effort attempt to detect if the app is running), so we should just
minimize the false positive rate.

Test: Try with "com.google.android.gm" when "com.google.android.gm.persistent" is running
Change-Id: I3204131aaaf53df9d7972f8bce37602dfd8324d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1820091Reviewed-by: default avatarAndrew Luo <aluo@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699907}
parent f81df298
......@@ -40,8 +40,8 @@ def _WaitUntilCtrlC():
def CheckAppNotRunning(device, package_name, force):
processes = device.ListProcesses(package_name)
if processes:
is_running = bool(device.GetApplicationPids(package_name))
if is_running:
msg = ('Netlog requires setting commandline flags, which only works if the '
'application ({}) is not already running. Please kill the app and '
'restart the script.'.format(
......
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