Index: build/android/devil/android/device_utils.py |
diff --git a/build/android/devil/android/device_utils.py b/build/android/devil/android/device_utils.py |
index 73ed277c65d40aca9171ed28b7224e69d9292695..83a806fd7bfdd6e917d5698507c1dcfcac6637a8 100644 |
--- a/build/android/devil/android/device_utils.py |
+++ b/build/android/devil/android/device_utils.py |
@@ -1009,7 +1009,8 @@ class DeviceUtils(object): |
CommandTimeoutError on timeout. |
DeviceUnreachableError on missing device. |
""" |
- self.RunShellCommand(['am', 'force-stop', package], check_return=True) |
+ cmd = 'p=%s;if [[ "$(ps)" = *$p* ]]; then am force-stop $p; fi' |
+ self.RunShellCommand(cmd % package, check_return=True) |
@decorators.WithTimeoutAndRetriesFromInstance() |
def ClearApplicationState( |