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

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

Issue 1293143002: [Android] Change battery_utils TieredSetCharging from exceptions based to discovery based (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | build/android/pylib/device/battery_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/battery_utils.py
diff --git a/build/android/pylib/device/battery_utils.py b/build/android/pylib/device/battery_utils.py
index ac5e7a87ae9187709b1d16f0f18bd6bb78dda183..858f7c5be2d3ac196fbd54afafd34d26539ae995 100644
--- a/build/android/pylib/device/battery_utils.py
+++ b/build/android/pylib/device/battery_utils.py
@@ -487,20 +487,17 @@ class BatteryUtils(object):
logging.warning('Device charging already in expected state: %s', enabled)
return
+ self._DiscoverDeviceProfile()
if enabled:
- try:
+ if self._cache['profile']['enable_command']:
self.SetCharging(enabled)
- except device_errors.CommandFailedError:
- logging.info('Unable to enable charging via hardware.'
- ' Falling back to software enabling.')
+ else:
perezju 2015/08/18 09:14:15 nit: maybe keep a logging.info to indicate whether
rnephew (Wrong account) 2015/08/18 14:54:53 Done.
self.EnableBatteryUpdates()
else:
- try:
+ if self._cache['profile']['enable_command']:
self._ClearPowerData()
self.SetCharging(enabled)
- except device_errors.CommandFailedError:
- logging.info('Unable to disable charging via hardware.'
- ' Falling back to software disabling.')
+ else:
self.DisableBatteryUpdates()
@contextlib.contextmanager
« no previous file with comments | « no previous file | build/android/pylib/device/battery_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698