from pylib import constants
from pylib.cmd_helper import GetCmdOutput
from pylib.device import device_blacklist
-from pylib.device import device_errors
from pylib.device import device_list
from pylib.device import device_utils
errors = []
dev_good = True
if battery_level < 15:
- errors += ['Device critically low in battery. Turning off device.']
+ errors += ['Device critically low in battery. Will add to blacklist.']
dev_good = False
+ if not device_adb.old_interface.IsDeviceCharging():
+ if device_adb.old_interface.CanControlUsbCharging():
+ device_adb.old_interface.EnableUsbCharging()
+ else:
+ logging.error('Device %s is not charging' % serial)
if not options.no_provisioning_check:
setup_wizard_disabled = (
device_adb.GetProp('ro.setupwizard.mode') == 'DISABLED')
battery_info.get('AC powered', None) != 'true'):
errors += ['Mantaray device not connected to AC power.']
- # Turn off devices with low battery.
- if battery_level < 15:
- try:
- device_adb.EnableRoot()
- except device_errors.CommandFailedError as e:
- # Attempt shutdown anyway.
- # TODO(jbudorick) Handle this exception appropriately after interface
- # conversions are finished.
- logging.error(str(e))
- device_adb.old_interface.Shutdown()
full_report = '\n'.join(report)
return device_type, device_build, battery_level, full_report, errors, dev_good
try:
if 'adb' in p.name:
yield p
- except (psutil.error.NoSuchProcess, psutil.error.AccessDenied):
+ except (psutil.NoSuchProcess, psutil.AccessDenied):
pass
for sig in [signal.SIGTERM, signal.SIGQUIT, signal.SIGKILL]:
print 'kill %d %d (%s [%s])' % (sig, p.pid, p.name,
' '.join(p.cmdline))
p.send_signal(sig)
- except (psutil.error.NoSuchProcess, psutil.error.AccessDenied):
+ except (psutil.NoSuchProcess, psutil.AccessDenied):
pass
for p in GetAllAdb():
try:
print 'Unable to kill %d (%s [%s])' % (p.pid, p.name, ' '.join(p.cmdline))
- except (psutil.error.NoSuchProcess, psutil.error.AccessDenied):
+ except (psutil.NoSuchProcess, psutil.AccessDenied):
pass
'unique_builds': unique_builds,
}))
- if False in fail_step_lst:
- # TODO(navabi): Build fails on device status check step if there exists any
- # devices with critically low battery. Remove those devices from testing,
- # allowing build to continue with good devices.
+ num_failed_devs = 0
+ for fail_status, device in zip(fail_step_lst, devices):
+ if not fail_status:
+ device_blacklist.ExtendBlacklist([str(device)])
+ num_failed_devs += 1
+
+ if num_failed_devs == len(devices):
return 2
if not devices: