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()
def __init__(self, device, finder_options): assert device, ( 'AndroidPlatformBackend can only be initialized from remote device' ) super(AndroidPlatformBackend, self).__init__(device) self._adb = adb_commands.AdbCommands(device=device.device_id) installed_prebuilt_tools = adb_commands.SetupPrebuiltTools(self._adb) 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._adb.IsRootEnabled(): # Ignore result. self._adb.EnableAdbRoot() self._device = self._adb.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 = [] self._can_access_protected_file_contents = (self._device.HasRoot() or self._device.NeedsSU()) self._device_copy_script = None power_controller = power_monitor_controller.PowerMonitorController([ monsoon_power_monitor.MonsoonPowerMonitor(self._device, self), android_ds2784_power_monitor.DS2784PowerMonitor( self._device, self), android_dumpsys_power_monitor.DumpsysPowerMonitor( self._battery, self), ]) self._power_monitor = android_temperature_monitor.AndroidTemperatureMonitor( power_controller, self._device) 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()
def __init__(self, device): assert device, ( 'AndroidPlatformBackend can only be initialized from remote device' ) super(AndroidPlatformBackend, self).__init__(device) self._adb = adb_commands.AdbCommands(device=device.device_id) installed_prebuilt_tools = adb_commands.SetupPrebuiltTools(self._adb) 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._adb.IsRootEnabled(): # Ignore result. self._adb.EnableAdbRoot() self._device = self._adb.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._can_access_protected_file_contents = \ self._device.old_interface.CanAccessProtectedFileContents() power_controller = power_monitor_controller.PowerMonitorController([ monsoon_power_monitor.MonsoonPowerMonitor(self._device, self), android_ds2784_power_monitor.DS2784PowerMonitor( self._device, self), android_dumpsys_power_monitor.DumpsysPowerMonitor( self._device, self), ]) self._power_monitor = android_temperature_monitor.AndroidTemperatureMonitor( power_controller, self._device) 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