| Index: build/android/pylib/perf/surface_stats_collector.py
|
| diff --git a/build/android/pylib/perf/surface_stats_collector.py b/build/android/pylib/perf/surface_stats_collector.py
|
| index f97911782b70177a9fa0625a8e3dc9a22490d0cf..223e18c97ce70230cc136378d3e43b74b295fe37 100644
|
| --- a/build/android/pylib/perf/surface_stats_collector.py
|
| +++ b/build/android/pylib/perf/surface_stats_collector.py
|
| @@ -7,6 +7,8 @@ import datetime
|
| import logging
|
| import re
|
| import threading
|
| +from pylib import android_commands
|
| +from pylib.device import device_utils
|
|
|
|
|
| # Log marker containing SurfaceTexture timestamps.
|
| @@ -20,7 +22,7 @@ class SurfaceStatsCollector(object):
|
| """Collects surface stats for a SurfaceView from the output of SurfaceFlinger.
|
|
|
| Args:
|
| - adb: the adb connection to use.
|
| + device: A DeviceUtils instance.
|
| """
|
| class Result(object):
|
| def __init__(self, name, value, unit):
|
| @@ -28,8 +30,11 @@ class SurfaceStatsCollector(object):
|
| self.value = value
|
| self.unit = unit
|
|
|
| - def __init__(self, adb):
|
| - self._adb = adb
|
| + def __init__(self, device):
|
| + # TODO(jbudorick) Remove once telemetry gets switched over.
|
| + if isinstance(device, android_commands.AndroidCommands):
|
| + device = device_utils.DeviceUtils(device)
|
| + self._device = device
|
| self._collector_thread = None
|
| self._use_legacy_method = False
|
| self._surface_before = None
|
| @@ -210,7 +215,7 @@ class SurfaceStatsCollector(object):
|
| """
|
| # The command returns nothing if it is supported, otherwise returns many
|
| # lines of result just like 'dumpsys SurfaceFlinger'.
|
| - results = self._adb.RunShellCommand(
|
| + results = self._device.old_interface.RunShellCommand(
|
| 'dumpsys SurfaceFlinger --latency-clear SurfaceView')
|
| return not len(results)
|
|
|
| @@ -253,7 +258,7 @@ class SurfaceStatsCollector(object):
|
| # We use the special "SurfaceView" window name because the statistics for
|
| # the activity's main window are not updated when the main web content is
|
| # composited into a SurfaceView.
|
| - results = self._adb.RunShellCommand(
|
| + results = self._device.old_interface.RunShellCommand(
|
| 'dumpsys SurfaceFlinger --latency SurfaceView',
|
| log_result=logging.getLogger().isEnabledFor(logging.DEBUG))
|
| if not len(results):
|
| @@ -291,7 +296,8 @@ class SurfaceStatsCollector(object):
|
| Returns:
|
| Dict of {page_flip_count (or 0 if there was an error), timestamp}.
|
| """
|
| - results = self._adb.RunShellCommand('service call SurfaceFlinger 1013')
|
| + results = self._device.old_interface.RunShellCommand(
|
| + 'service call SurfaceFlinger 1013')
|
| assert len(results) == 1
|
| match = re.search('^Result: Parcel\((\w+)', results[0])
|
| cur_surface = 0
|
|
|