Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: build/android/pylib/screenshot.py

Issue 1145153005: Revert of [Android] Remove adb_commands from telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 import logging 5 import logging
6 import os 6 import os
7 import tempfile 7 import tempfile
8 import time 8 import time
9 9
10 from pylib import cmd_helper 10 from pylib import cmd_helper
11 from pylib import constants
12 from pylib import device_signal 11 from pylib import device_signal
13 from pylib.device import device_errors 12 from pylib.device import device_errors
14 13
15 # TODO(jbudorick) Remove once telemetry gets switched over. 14 # TODO(jbudorick) Remove once telemetry gets switched over.
16 import pylib.android_commands 15 import pylib.android_commands
17 import pylib.device.device_utils 16 import pylib.device.device_utils
18 17
19 18
20 class VideoRecorder(object): 19 class VideoRecorder(object):
21 """Records a screen capture video from an Android Device (KitKat or newer). 20 """Records a screen capture video from an Android Device (KitKat or newer).
(...skipping 12 matching lines...) Expand all
34 # TODO(jbudorick) Remove once telemetry gets switched over. 33 # TODO(jbudorick) Remove once telemetry gets switched over.
35 if isinstance(device, pylib.android_commands.AndroidCommands): 34 if isinstance(device, pylib.android_commands.AndroidCommands):
36 device = pylib.device.device_utils.DeviceUtils(device) 35 device = pylib.device.device_utils.DeviceUtils(device)
37 self._device = device 36 self._device = device
38 self._device_file = ( 37 self._device_file = (
39 '%s/screen-recording.mp4' % device.GetExternalStoragePath()) 38 '%s/screen-recording.mp4' % device.GetExternalStoragePath())
40 self._recorder = None 39 self._recorder = None
41 self._recorder_stdout = None 40 self._recorder_stdout = None
42 self._is_started = False 41 self._is_started = False
43 42
44 self._args = [constants.GetAdbPath()] 43 self._args = ['adb']
45 if str(self._device): 44 if str(self._device):
46 self._args += ['-s', str(self._device)] 45 self._args += ['-s', str(self._device)]
47 self._args += ['shell', 'screenrecord', '--verbose'] 46 self._args += ['shell', 'screenrecord', '--verbose']
48 self._args += ['--bit-rate', str(megabits_per_second * 1000 * 1000)] 47 self._args += ['--bit-rate', str(megabits_per_second * 1000 * 1000)]
49 if size: 48 if size:
50 self._args += ['--size', '%dx%d' % size] 49 self._args += ['--size', '%dx%d' % size]
51 if rotate: 50 if rotate:
52 self._args += ['--rotate'] 51 self._args += ['--rotate']
53 self._args += [self._device_file] 52 self._args += [self._device_file]
54 53
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 # TODO(jbudorick): Merge filename generation with the logic for doing so in 90 # TODO(jbudorick): Merge filename generation with the logic for doing so in
92 # DeviceUtils. 91 # DeviceUtils.
93 host_file_name = ( 92 host_file_name = (
94 host_file 93 host_file
95 or 'screen-recording-%s.mp4' % time.strftime('%Y%m%dT%H%M%S', 94 or 'screen-recording-%s.mp4' % time.strftime('%Y%m%dT%H%M%S',
96 time.localtime())) 95 time.localtime()))
97 host_file_name = os.path.abspath(host_file_name) 96 host_file_name = os.path.abspath(host_file_name)
98 self._device.PullFile(self._device_file, host_file_name) 97 self._device.PullFile(self._device_file, host_file_name)
99 self._device.RunShellCommand('rm -f "%s"' % self._device_file) 98 self._device.RunShellCommand('rm -f "%s"' % self._device_file)
100 return host_file_name 99 return host_file_name
OLDNEW
« no previous file with comments | « build/android/pylib/device/device_utils.py ('k') | tools/telemetry/telemetry/core/android_process.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698