| Index: build/android/pylib/forwarder.py
|
| diff --git a/build/android/pylib/forwarder.py b/build/android/pylib/forwarder.py
|
| index 36226d193812c64ab03d4258717e7198d471f704..b8952cc1b8a6d1911792f08a8846cc2269bab28e 100644
|
| --- a/build/android/pylib/forwarder.py
|
| +++ b/build/android/pylib/forwarder.py
|
| @@ -9,6 +9,7 @@ import logging
|
| import os
|
| import psutil
|
|
|
| +from devil import devil_env
|
| from devil.android.valgrind_tools import base_tool
|
| from devil.utils import cmd_helper
|
| from pylib import constants
|
| @@ -77,7 +78,7 @@ class Forwarder(object):
|
|
|
| device_serial = str(device)
|
| redirection_commands = [
|
| - ['--adb=' + constants.GetAdbPath(),
|
| + ['--adb=' + devil_env.config.FetchPath('adb'),
|
| '--serial-id=' + device_serial,
|
| '--map', str(device_port), str(host_port)]
|
| for device_port, host_port in port_pairs]
|
| @@ -197,11 +198,8 @@ class Forwarder(object):
|
| self._initialized_devices = set()
|
| self._device_to_host_port_map = dict()
|
| self._host_to_device_port_map = dict()
|
| - self._host_forwarder_path = os.path.join(
|
| - constants.GetOutDirectory(), 'host_forwarder')
|
| + self._host_forwarder_path = devil_env.config.FetchPath('forwarder_host')
|
| assert os.path.exists(self._host_forwarder_path), 'Please build forwarder2'
|
| - self._device_forwarder_path_on_host = os.path.join(
|
| - constants.GetOutDirectory(), 'forwarder_dist')
|
| self._InitHostLocked()
|
|
|
| @staticmethod
|
| @@ -216,7 +214,7 @@ class Forwarder(object):
|
| if not serial_with_port in instance._device_to_host_port_map:
|
| logging.error('Trying to unmap non-forwarded port %d', device_port)
|
| return
|
| - redirection_command = ['--adb=' + constants.GetAdbPath(),
|
| + redirection_command = ['--adb=' + devil_env.config.FetchPath('adb'),
|
| '--serial-id=' + serial,
|
| '--unmap', str(device_port)]
|
| logging.info('Undo forwarding using command: %s', redirection_command)
|
| @@ -279,9 +277,16 @@ class Forwarder(object):
|
| if device_serial in self._initialized_devices:
|
| return
|
| Forwarder._KillDeviceLocked(device, tool)
|
| + forwarder_device_path_on_host = devil_env.config.FetchPath(
|
| + 'forwarder_device', device=device)
|
| + forwarder_device_path_on_device = (
|
| + Forwarder._DEVICE_FORWARDER_FOLDER
|
| + if os.path.isdir(forwarder_device_path_on_host)
|
| + else Forwarder._DEVICE_FORWARDER_PATH)
|
| device.PushChangedFiles([(
|
| - self._device_forwarder_path_on_host,
|
| - Forwarder._DEVICE_FORWARDER_FOLDER)])
|
| + forwarder_device_path_on_host,
|
| + forwarder_device_path_on_device)])
|
| +
|
| cmd = '%s %s' % (tool.GetUtilWrapper(), Forwarder._DEVICE_FORWARDER_PATH)
|
| device.RunShellCommand(
|
| cmd, env={'LD_LIBRARY_PATH': Forwarder._DEVICE_FORWARDER_FOLDER},
|
|
|