Пример #1
0
  def __init__(self, device, require_root):
    assert device, (
        'AndroidPlatformBackend can only be initialized from remote device')
    super(AndroidPlatformBackend, self).__init__(device)
    self._device = device_utils.DeviceUtils(device.device_id)
    self._require_root = require_root
    if self._require_root:
      # Trying to root the device, if possible.
      if not self._device.HasRoot():
        try:
          self._device.EnableRoot()
        except device_errors.CommandFailedError:
          logging.warning('Unable to root %s', str(self._device))
      self._can_elevate_privilege = (
          self._device.HasRoot() or self._device.NeedsSU())
      assert self._can_elevate_privilege, (
          'Android device must have root access to run Telemetry')
      self._enable_performance_mode = device.enable_performance_mode
    else:
      self._enable_performance_mode = False
    self._battery = battery_utils.BatteryUtils(self._device)
    self._surface_stats_collector = None
    self._perf_tests_setup = perf_control.PerfControl(self._device)
    self._thermal_throttle = thermal_throttle.ThermalThrottle(self._device)
    self._raw_display_frame_rate_measurements = []
    self._device_copy_script = None
    self._system_ui = None

    _FixPossibleAdbInstability()
Пример #2
0
  def __init__(self, device):
    assert device, (
        'AndroidPlatformBackend can only be initialized from remote device')
    super(AndroidPlatformBackend, self).__init__(device)
    self._device = device_utils.DeviceUtils(device.device_id)
    # Trying to root the device, if possible.
    if not self._device.HasRoot():
      try:
        self._device.EnableRoot()
      except device_errors.CommandFailedError:
        logging.warning('Unable to root %s', str(self._device))
    self._can_elevate_privilege = (
        self._device.HasRoot() or self._device.NeedsSU())
    assert self._can_elevate_privilege, (
        'Android device must have root access to run Telemetry')
    self._battery = battery_utils.BatteryUtils(self._device)
    self._enable_performance_mode = device.enable_performance_mode
    self._surface_stats_collector = None
    self._perf_tests_setup = perf_control.PerfControl(self._device)
    self._thermal_throttle = thermal_throttle.ThermalThrottle(self._device)
    self._raw_display_frame_rate_measurements = []
    self._device_copy_script = None
    self._power_monitor = (
        android_power_monitor_controller.AndroidPowerMonitorController([
            android_temperature_monitor.AndroidTemperatureMonitor(self._device),
            android_dumpsys_power_monitor.DumpsysPowerMonitor(
                self._battery, self),
            sysfs_power_monitor.SysfsPowerMonitor(self, standalone=True),
            android_fuelgauge_power_monitor.FuelGaugePowerMonitor(
                self._battery),
        ], self._battery))
    self._video_recorder = None
    self._system_ui = None

    _FixPossibleAdbInstability()
Пример #3
0
    def __init__(self, device, require_root):
        assert device, (
            'AndroidPlatformBackend can only be initialized from remote device'
        )
        super(AndroidPlatformBackend, self).__init__(device)
        self._device = device_utils.DeviceUtils(device.device_id)
        self._can_elevate_privilege = False
        self._require_root = require_root
        if self._require_root:
            # Trying to root the device, if possible.
            if not self._device.HasRoot():
                try:
                    self._device.EnableRoot()
                except device_errors.CommandFailedError:
                    logging.warning('Unable to root %s', str(self._device))
            self._can_elevate_privilege = (self._device.HasRoot()
                                           or self._device.NeedsSU())
            assert self._can_elevate_privilege, (
                'Android device must have root access to run Telemetry')
        self._battery = battery_utils.BatteryUtils(self._device)
        self._surface_stats_collector = None
        self._perf_tests_setup = perf_control.PerfControl(self._device)
        self._thermal_throttle = thermal_throttle.ThermalThrottle(self._device)
        self._raw_display_frame_rate_measurements = []
        self._device_copy_script = None
        self._system_ui = None
        self._device_host_clock_offset = None
        self._video_recorder = None

        # TODO(https://crbug.com/1026296): Remove this once --chromium-output-dir
        # has a default value we can use.
        self._build_dir = util.GetUsedBuildDirectory()

        _FixPossibleAdbInstability()
Пример #4
0
    def __init__(self, device, finder_options):
        assert device, (
            'AndroidPlatformBackend can only be initialized from remote device'
        )
        super(AndroidPlatformBackend, self).__init__(device)
        self._device = device_utils.DeviceUtils(device.device_id)
        installed_prebuilt_tools = _SetupPrebuiltTools(self._device)
        if not installed_prebuilt_tools:
            logging.error(
                '%s detected, however prebuilt android tools could not '
                'be used. To run on Android you must build them first:\n'
                '  $ ninja -C out/Release android_tools' % device.name)
            raise exceptions.PlatformError()
        # Trying to root the device, if possible.
        if not self._device.HasRoot():
            try:
                self._device.EnableRoot()
            except device_errors.CommandFailedError:
                logging.warning('Unable to root %s', str(self._device))
        self._battery = battery_utils.BatteryUtils(self._device)
        self._enable_performance_mode = device.enable_performance_mode
        self._surface_stats_collector = None
        self._perf_tests_setup = perf_control.PerfControl(self._device)
        self._thermal_throttle = thermal_throttle.ThermalThrottle(self._device)
        self._raw_display_frame_rate_measurements = []
        try:
            self._can_access_protected_file_contents = (self._device.HasRoot()
                                                        or
                                                        self._device.NeedsSU())
        except Exception:
            logging.exception('New exception caused by DeviceUtils conversion')
            raise
        self._device_copy_script = None
        self._power_monitor = (
            android_power_monitor_controller.AndroidPowerMonitorController([
                android_temperature_monitor.AndroidTemperatureMonitor(
                    self._device),
                monsoon_power_monitor.MonsoonPowerMonitor(self._device, self),
                android_dumpsys_power_monitor.DumpsysPowerMonitor(
                    self._battery, self),
                sysfs_power_monitor.SysfsPowerMonitor(self, standalone=True),
                android_fuelgauge_power_monitor.FuelGaugePowerMonitor(
                    self._battery, self),
            ], self._battery))
        self._video_recorder = None
        self._installed_applications = None

        self._wpr_ca_cert_path = None
        self._device_cert_util = None
        self._is_test_ca_installed = False

        self._use_rndis_forwarder = (
            finder_options.android_rndis
            or finder_options.browser_options.netsim
            or platform.GetHostPlatform().GetOSName() != 'linux')

        _FixPossibleAdbInstability()