Chromium Code Reviews| 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 e9d16935ad2fc307b406fb5e8e45b5b7decf4993..87345025e8d3a12aad70ae42d6ee78d5a7f38116 100644 |
| --- a/build/android/devil/android/device_utils.py |
| +++ b/build/android/devil/android/device_utils.py |
| @@ -928,14 +928,23 @@ class DeviceUtils(object): |
| if extras is None: |
| extras = {} |
| - cmd = ['am', 'instrument'] |
| + # Store the package name in a shell variable to help the command stay under |
| + # the _MAX_ADB_COMMAND_LENGTH limit. |
| + package = component.split('/')[0] |
| + def shrink(value): |
|
jbudorick
2015/10/08 14:27:28
I don't agree with handling this this way. It lead
agrieve
2015/10/08 15:42:10
RunShellCommand can already be passed env variable
jbudorick
2015/10/08 15:51:09
Yeah, I didn't think env would work here.
agrieve
2015/10/08 20:03:33
Extracted it into a helper. Wasn't actually able t
|
| + parts = (x and cmd_helper.SingleQuote(x) for x in value.split(package)) |
| + return '$p'.join(parts) |
| + |
| + cmd = 'p=%s;am instrument' % package |
| if finish: |
| - cmd.append('-w') |
| + cmd += ' -w' |
| if raw: |
| - cmd.append('-r') |
| + cmd += ' -r' |
| + |
| for k, v in extras.iteritems(): |
| - cmd.extend(['-e', str(k), str(v)]) |
| - cmd.append(component) |
| + cmd += ' -e %s %s' % (shrink(str(k)), shrink(str(v))) |
| + |
| + cmd += ' %s' % shrink(component) |
| return self.RunShellCommand(cmd, check_return=True, large_output=True) |
| @decorators.WithTimeoutAndRetriesFromInstance() |