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

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

Issue 1066253003: Disable ac charging similar to usb charging (used by Nexus6) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Limit BatteryDisable/EnableUpdates to only L+ devices Created 5 years, 8 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 cca89c725e6e1608b1d674ebfa319709af5ca6fa..46800c3569236416682fbd5c2cf87fdcd621a4c0 100644
--- a/build/android/pylib/device/battery_utils.py
+++ b/build/android/pylib/device/battery_utils.py
@@ -237,8 +237,12 @@ class BatteryUtils(object):
def battery_updates_disabled():
return self.GetCharging() is False
+ if (self._device.build_version_sdk <
jbudorick 2015/04/08 17:43:11 Please add this exception to the Raises: section o
fmeawad 2015/04/08 18:00:23 Done.
+ constants.ANDROID_SDK_VERSION_CODES.LOLLIPOP):
+ raise device_errors.DeviceVersionError('Device must be L or higher.')
+
self._device.RunShellCommand(
- ['dumpsys', 'battery', 'set', 'usb', '1'], check_return=True)
+ ['dumpsys', 'battery', 'reset'], check_return=True)
self._device.RunShellCommand(
['dumpsys', 'batterystats', '--reset'], check_return=True)
battery_data = self._device.RunShellCommand(
@@ -252,6 +256,8 @@ class BatteryUtils(object):
and l[PWI_POWER_INDEX] != 0):
raise device_errors.CommandFailedError(
'Non-zero pmi value found after reset.')
+ self._device.RunShellCommand(['dumpsys', 'battery', 'set', 'ac', '0'],
+ check_return=True)
self._device.RunShellCommand(['dumpsys', 'battery', 'set', 'usb', '0'],
check_return=True)
timeout_retry.WaitFor(battery_updates_disabled, wait_period=1)
@@ -267,8 +273,10 @@ class BatteryUtils(object):
def battery_updates_enabled():
return self.GetCharging() is True
- self._device.RunShellCommand(['dumpsys', 'battery', 'set', 'usb', '1'],
- check_return=True)
+ if (self._device.build_version_sdk <
jbudorick 2015/04/08 17:43:11 same here
fmeawad 2015/04/08 18:00:23 Done.
+ constants.ANDROID_SDK_VERSION_CODES.LOLLIPOP):
+ raise device_errors.DeviceVersionError('Device must be L or higher.')
+
self._device.RunShellCommand(['dumpsys', 'battery', 'reset'],
check_return=True)
timeout_retry.WaitFor(battery_updates_enabled, wait_period=1)
« 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