def blacklisting_install(device):
    try:
        if args.splits:
            device.InstallSplitApk(apk, splits, reinstall=args.keep_data, allow_downgrade=args.downgrade)
        else:
            device.Install(apk, reinstall=args.keep_data, allow_downgrade=args.downgrade, timeout=args.timeout)
    except device_errors.CommandFailedError:
        logging.exception('Failed to install %s', args.apk_name)
        if blacklist:
            blacklist.Extend([str(device)], reason='install_failure')
            logging.warning('Blacklisting %s', str(device))
    except device_errors.CommandTimeoutError:
        logging.exception('Timed out while installing %s', args.apk_name)
        if blacklist:
            blacklist.Extend([str(device)], reason='install_timeout')
            logging.warning('Blacklisting %s', str(device))
def blacklisting_install(device):
    try:
        if args.splits:
            device.InstallSplitApk(apk, splits, reinstall=args.keep_data, allow_downgrade=args.downgrade)
        else:
            device.Install(apk, reinstall=args.keep_data, allow_downgrade=args.downgrade, timeout=args.timeout)
    except device_errors.CommandFailedError:
        logging.exception('Failed to install %s', args.apk_name)
        if blacklist:
            blacklist.Extend([str(device)], reason='install_failure')
            logging.warning('Blacklisting %s', str(device))
    except device_errors.CommandTimeoutError:
        logging.exception('Timed out while installing %s', args.apk_name)
        if blacklist:
            blacklist.Extend([str(device)], reason='install_timeout')
            logging.warning('Blacklisting %s', str(device))