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

Unified Diff: tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor.py

Issue 1132993004: [Android] Remove more references to and uses of AndroidCommands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor.py
diff --git a/tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor.py b/tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor.py
index 25c375b8740de640db74c8e0ed8c236d5b591837..92abae1801677ba26906a9616ae9b1c1bd281141 100644
--- a/tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor.py
+++ b/tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor.py
@@ -5,10 +5,14 @@
import logging
import os
+from telemetry.core import util
from telemetry.core.platform.power_monitor import sysfs_power_monitor
from telemetry.core.platform.profiler import android_prebuilt_profiler_helper
from telemetry import decorators
+util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'build', 'android')
+from pylib.device import battery_utils # pylint: disable=F0401
+
SAMPLE_RATE_HZ = 2 # The data is collected from the ds2784 fuel gauge chip
# that only updates its data every 3.5s.
@@ -27,6 +31,7 @@ class DS2784PowerMonitor(sysfs_power_monitor.SysfsPowerMonitor):
def __init__(self, device, platform_backend):
super(DS2784PowerMonitor, self).__init__(platform_backend)
self._device = device
+ self._device_battery = battery_utils.BatteryUtils(self._device)
self._powermonitor_process_port = None
self._file_poller_binary = android_prebuilt_profiler_helper.GetDevicePath(
'file_poller')
@@ -38,8 +43,8 @@ class DS2784PowerMonitor(sysfs_power_monitor.SysfsPowerMonitor):
def CanMonitorPower(self):
if not self._HasFuelGauge():
return False
- if self._device.old_interface.IsDeviceCharging():
- logging.warning('Can\'t monitor power usage since device is charging.')
+ if self._device_battery.GetCharging():
+ logging.warning("Can't monitor power usage since device is charging.")
return False
return True

Powered by Google App Engine
This is Rietveld 408576698