Index: build/android/device_status_check.py |
diff --git a/build/android/device_status_check.py b/build/android/device_status_check.py |
index 2aa4d73c9caa8641a9259926904c8bf9fa21db88..5f78ddce3d87a2d3778c5748c355b84ffd52e745 100755 |
--- a/build/android/device_status_check.py |
+++ b/build/android/device_status_check.py |
@@ -37,8 +37,12 @@ def DeviceInfo(serial): |
setup_wizard_disabled = AdbShellCmd( |
'getprop ro.setupwizard.mode') == 'DISABLED' |
battery = AdbShellCmd('dumpsys battery') |
- battery_level = int(re.findall('level: (\d+)', battery)[0]) |
- battery_temp = float(re.findall('temperature: (\d+)', battery)[0])/10 |
+ if 'Error' in battery: |
+ battery_level = 'Unknown' |
+ battery_temp = 'Unknown' |
+ else: |
+ battery_level = int(re.findall('level: (\d+)', battery)[0]) |
+ battery_temp = float(re.findall('temperature: (\d+)', battery)[0]) / 10 |
report = ['Device %s (%s)' % (serial, device_type), |
' Build: %s (%s)' % (device_build, |
AdbShellCmd('getprop ro.build.fingerprint')), |