Index: build/android/pylib/android_commands.py |
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
index 852a1ce0a9a0196fb0a275e7fb55e0c787653261..8a4f9ad03d3fc55115c305a91de1eac2797c14a1 100644 |
--- a/build/android/pylib/android_commands.py |
+++ b/build/android/pylib/android_commands.py |
@@ -505,7 +505,8 @@ class AndroidCommands(object): |
return 0 |
return processes_killed |
- def StartActivity(self, package, activity, wait_for_completion=False, |
+ def StartActivity(self, package, activity, |
+ force_stop=False, wait_for_completion=False, |
bulach
2012/10/30 10:52:50
nit: new default params should always be added at
frankf
2012/10/30 19:05:22
Done.
On 2012/10/30 10:52:50, bulach wrote:
|
action='android.intent.action.VIEW', |
category=None, data=None, |
extras=None, trace_file_name=None): |
@@ -515,6 +516,8 @@ class AndroidCommands(object): |
package: Name of package to start (e.g. 'com.google.android.apps.chrome'). |
activity: Name of activity (e.g. '.Main' or |
'com.google.android.apps.chrome.Main'). |
+ force_stop: force stop the target app before starting the activity (-S |
+ flag). |
wait_for_completion: wait for the activity to finish launching (-W flag). |
action: string (e.g. "android.intent.action.MAIN"). Default is VIEW. |
category: string (e.g. "android.intent.category.HOME") |
@@ -523,6 +526,8 @@ class AndroidCommands(object): |
trace_file_name: If used, turns on and saves the trace to this file name. |
""" |
cmd = 'am start -a %s' % action |
+ if force_stop: |
+ cmd += ' -S' |
if wait_for_completion: |
cmd += ' -W' |
if category: |
@@ -1080,4 +1085,3 @@ class NewLineNormalizer(object): |
def flush(self): |
self._output.flush() |
- |