OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Android-specific, installs pre-built profilers.""" | 5 """Android-specific, installs pre-built profilers.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 | 9 |
10 from telemetry import decorators | 10 from telemetry import decorators |
11 from telemetry.util import support_binaries | 11 from telemetry.util import support_binaries |
12 | 12 |
13 | 13 |
14 _DEVICE_PROFILER_DIR = '/data/local/tmp/profilers/' | 14 _DEVICE_PROFILER_DIR = '/data/local/tmp/profilers/' |
15 | 15 |
16 | 16 |
17 def GetDevicePath(profiler_binary): | 17 def GetDevicePath(profiler_binary): |
18 return os.path.join(_DEVICE_PROFILER_DIR, os.path.basename(profiler_binary)) | 18 return os.path.join(_DEVICE_PROFILER_DIR, os.path.basename(profiler_binary)) |
19 | 19 |
20 | 20 |
21 @decorators.Cache | 21 @decorators.Cache |
22 def InstallOnDevice(device, profiler_binary): | 22 def InstallOnDevice(device, profiler_binary): |
23 host_path = support_binaries.FindPath(profiler_binary, 'android') | 23 host_path = support_binaries.FindPath(profiler_binary, 'android') |
24 if not host_path: | 24 if not host_path: |
25 logging.error('Profiler binary "%s" not found. Could not be installed', | 25 logging.error('Profiler binary "%s" not found. Could not be installed', |
26 host_path) | 26 host_path) |
27 return False | 27 return False |
28 | 28 |
29 device_binary_path = GetDevicePath(profiler_binary) | 29 device_binary_path = GetDevicePath(profiler_binary) |
30 device.old_interface.PushIfNeeded(host_path, device_binary_path) | 30 device.PushChangedFiles(host_path, device_binary_path) |
31 device.RunShellCommand('chmod 777 ' + device_binary_path) | 31 device.RunShellCommand('chmod 777 ' + device_binary_path) |
32 return True | 32 return True |
33 | 33 |
OLD | NEW |