Update sdk/platform-tools to version 26.0.0.
[android_tools.git] / sdk / platform-tools / systrace / catapult / telemetry / telemetry / internal / platform / profiler / android_prebuilt_profiler_helper.py
blob77e23141a2b920bbe1b34807bd80616553556900
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
3 # found in the LICENSE file.
5 """Android-specific, installs pre-built profilers."""
7 import logging
8 import os
10 from telemetry.internal.util import binary_manager
11 from telemetry import decorators
13 _DEVICE_PROFILER_DIR = '/data/local/tmp/profilers/'
16 def GetDevicePath(profiler_binary):
17 return os.path.join(_DEVICE_PROFILER_DIR, os.path.basename(profiler_binary))
20 @decorators.Cache
21 def InstallOnDevice(device, profiler_binary):
22 arch_name = device.GetABI()
23 host_path = binary_manager.FetchPath(profiler_binary, arch_name, 'android')
24 if not host_path:
25 logging.error('Profiler binary "%s" not found. Could not be installed',
26 host_path)
27 return False
29 device_binary_path = GetDevicePath(profiler_binary)
30 device.PushChangedFiles([(host_path, device_binary_path)])
31 device.RunShellCommand(
32 ['chmod', '777', device_binary_path], check_return=True)
33 return True