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, downloads and installs pre-built profilers.
7 These pre-built binaries are stored in Cloud Storage, and they were
8 built from AOSP source. Specific profilers using this helper class contain
9 more detailed information.
14 from telemetry import decorators
15 from telemetry.core import util
16 from telemetry.page import cloud_storage
19 _DEVICE_PROFILER_DIR = '/data/local/tmp/profilers/'
22 def GetDevicePath(profiler_binary):
23 return os.path.join(_DEVICE_PROFILER_DIR, os.path.basename(profiler_binary))
26 def GetHostPath(profiler_binary):
27 return os.path.join(util.GetTelemetryDir(),
28 'bin', 'prebuilt', 'android', profiler_binary)
31 def GetIfChanged(profiler_binary):
32 cloud_storage.GetIfChanged(GetHostPath(profiler_binary),
33 cloud_storage.PUBLIC_BUCKET)
37 def InstallOnDevice(adb, profiler_binary):
38 GetIfChanged(profiler_binary)
39 adb.PushIfNeeded(GetHostPath(profiler_binary), GetDevicePath(profiler_binary))
40 adb.RunShellCommand('chmod 777 ' + GetDevicePath(profiler_binary))