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.core import util
15 from telemetry.page import cloud_storage
18 _DEVICE_PROFILER_DIR = '/data/local/tmp/profilers/'
21 def GetDevicePath(profiler_binary):
22 return os.path.join(_DEVICE_PROFILER_DIR, os.path.basename(profiler_binary))
25 def GetHostPath(profiler_binary):
26 return os.path.join(util.GetTelemetryDir(),
27 'bin', 'prebuilt', 'android', profiler_binary)
30 def GetIfChanged(profiler_binary):
31 cloud_storage.GetIfChanged(GetHostPath(profiler_binary),
32 cloud_storage.PUBLIC_BUCKET)
35 def InstallOnDevice(adb, profiler_binary):
36 GetIfChanged(profiler_binary)
37 adb.PushIfNeeded(GetHostPath(profiler_binary), GetDevicePath(profiler_binary))
38 adb.RunShellCommand('chmod 777 ' + GetDevicePath(profiler_binary))