Index: build/android/pylib/device/device_utils.py |
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py |
index fe9d2c64324ecb378bf43b4c63aa8e1d13a94acc..e249bf60c2577ae41232109e189666bbcf0fa082 100644 |
--- a/build/android/pylib/device/device_utils.py |
+++ b/build/android/pylib/device/device_utils.py |
@@ -622,13 +622,16 @@ class DeviceUtils(object): |
self.RunShellCommand(['am', 'force-stop', package], check_return=True) |
@decorators.WithTimeoutAndRetriesFromInstance() |
- def ClearApplicationState(self, package, timeout=None, retries=None): |
+ def ClearApplicationState(self, package, timeout=None, retries=None, |
+ package_check_needed=True): |
jbudorick
2015/01/16 14:21:41
timeout and retries should be the last 2 parameter
Jaekyun Seok (inactive)
2015/01/18 23:01:18
Done.
|
"""Clear all state for the given package. |
Args: |
package: A string containing the name of the package to stop. |
timeout: timeout in seconds |
retries: number of retries |
+ package_check_needed: Whether the package existence should be checked or |
+ not |
Raises: |
CommandTimeoutError on timeout. |
@@ -636,7 +639,7 @@ class DeviceUtils(object): |
""" |
# Check that the package exists before clearing it. Necessary because |
# calling pm clear on a package that doesn't exist may never return. |
- if self.GetApplicationPath(package): |
+ if (not package_check_needed) or self.GetApplicationPath(package): |
jbudorick
2015/01/16 14:21:41
I'm extremely wary about adding more somewhat supe
Jaekyun Seok (inactive)
2015/01/18 23:01:18
I agree with your concern, but each call to self.G
jbudorick
2015/01/20 14:11:23
That's reasonable; I'm just not sure that the clie
Jaekyun Seok (inactive)
2015/01/20 22:00:23
Caching device status seems dangerous because we c
jbudorick
2015/01/20 22:04:04
What do you mean by "we can't track all the status
Jaekyun Seok (inactive)
2015/01/20 22:11:17
For example, a package could be uninstalled by dev
jbudorick
2015/01/20 22:22:43
I think that case is less risky than the current i
Jaekyun Seok (inactive)
2015/01/20 23:20:35
I see. I will add cache to store application paths
jbudorick
2015/01/20 23:34:24
This could probably be integrated into the existin
perezju
2015/01/21 10:28:52
Yeah, I also dislike the idea of adding this optio
jbudorick
2015/01/21 14:57:00
My concern in this case is that AdbWrapper handles
jbudorick
2015/01/21 15:03:14
If this last part _does_ work on versions starting
|
self.RunShellCommand(['pm', 'clear', package], check_return=True) |
@decorators.WithTimeoutAndRetriesFromInstance() |