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

Unified Diff: build/android/pylib/device/device_utils.py

Issue 1040473002: [android] Create Battery Utils to seperate power functionality (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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: build/android/pylib/device/device_utils.py
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py
index 9f538e1b0efd9f51ffaa4c1345febe8149edccc6..34ae2efb4ae5320d9bb3c2913b57094f99024ff9 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -1438,6 +1438,7 @@ class DeviceUtils(object):
"""
return logcat_monitor.LogcatMonitor(self.adb, *args, **kwargs)
+ # TODO(rnephew): Remove when battery_utils is switched to.
@decorators.WithTimeoutAndRetriesFromInstance()
def GetBatteryInfo(self, timeout=None, retries=None):
"""Gets battery info for the device.
@@ -1465,6 +1466,7 @@ class DeviceUtils(object):
result[k.strip()] = v.strip()
return result
+ # TODO(rnephew): Remove when battery_utils is switched to.
@decorators.WithTimeoutAndRetriesFromInstance()
def GetCharging(self, timeout=None, retries=None):
"""Gets the charging state of the device.
@@ -1482,6 +1484,7 @@ class DeviceUtils(object):
return True
return False
+ # TODO(rnephew): Remove when battery_utils is switched to.
@decorators.WithTimeoutAndRetriesFromInstance()
def SetCharging(self, enabled, timeout=None, retries=None):
"""Enables or disables charging on the device.
@@ -1512,7 +1515,7 @@ class DeviceUtils(object):
timeout_retry.WaitFor(set_and_verify_charging, wait_period=1)
- # TODO(rnephew): Make private when all use cases can use the context manager.
+ # TODO(rnephew): Remove when battery_utils is switched to.
@decorators.WithTimeoutAndRetriesFromInstance()
def DisableBatteryUpdates(self, timeout=None, retries=None):
""" Resets battery data and makes device appear like it is not
@@ -1542,7 +1545,7 @@ class DeviceUtils(object):
check_return=True)
timeout_retry.WaitFor(battery_updates_disabled, wait_period=1)
- # TODO(rnephew): Make private when all use cases can use the context manager.
+ # TODO(rnephew): Remove when battery_utils is switched to.
@decorators.WithTimeoutAndRetriesFromInstance()
def EnableBatteryUpdates(self, timeout=None, retries=None):
""" Restarts device charging so that dumpsys no longer collects power data.
@@ -1559,6 +1562,7 @@ class DeviceUtils(object):
self.RunShellCommand(['dumpsys', 'battery', 'reset'], check_return=True)
timeout_retry.WaitFor(battery_updates_enabled, wait_period=1)
+ # TODO(rnephew): Remove when battery_utils is switched to.
@contextlib.contextmanager
def BatteryMeasurement(self, timeout=None, retries=None):
"""Context manager that enables battery data collection. It makes
@@ -1648,3 +1652,11 @@ class DeviceUtils(object):
return parallelizer.Parallelizer(devices)
else:
return parallelizer.SyncParallelizer(devices)
+
+ def GetCacheEntry(self, key):
jbudorick 2015/03/27 13:26:36 We talked about protecting cache users from overwr
rnephew (Wrong account) 2015/03/27 22:17:02 I've made it so it wont override what others put i
+ """Cache getter."""
+ return self._cache.get(key)
+
+ def SetCacheEntry(self, key, value):
+ """Cache setter."""
+ self._cache[key] = value

Powered by Google App Engine
This is Rietveld 408576698