Exemplo n.º 1
0
def update_details(binary_manager: binaries_util.BinaryManager,
                   device: Device) -> None:

    check(
        device.HasField("android"),
        AssertionError(f"Expected Android device: {device}"),
    )

    build_fingerprint = ""
    try:
        adb_fingerprint_result = adb_check(
            device.android.serial,
            ["shell", "getprop ro.build.fingerprint"],
            verbose=True,
        )
        build_fingerprint = adb_fingerprint_result.stdout
        build_fingerprint = build_fingerprint.strip()
    except subprocess.CalledProcessError:
        log("Failed to get device fingerprint")

    device_properties = ""
    ensure_amber_installed(device.android.serial, binary_manager)
    try:
        device_properties = get_device_driver_details(device.android.serial)
    except devices_util.GetDeviceDetailsError as ex:
        log(f"WARNING: Failed to get device driver details: {ex}")

    device.android.build_fingerprint = build_fingerprint
    device.device_properties = device_properties
Exemplo n.º 2
0
def _update_device_host(binary_manager: binaries_util.BinaryManager,
                        device: Device) -> None:
    check(
        device.HasField("host"),
        AssertionError(f"Expected host device: {device}"),
    )

    amber_path = binary_manager.get_binary_path_by_name(
        binaries_util.AMBER_NAME).path

    driver_details = ""
    try:
        driver_details = host_device_util.get_driver_details(
            amber_path, custom_launcher=list(device.host.custom_launcher))
    except GetDeviceDetailsError as ex:
        log(f"WARNING: Failed to get device driver details: {ex}")

    device.device_properties = driver_details
Exemplo n.º 3
0
def _update_device_swiftshader(binary_manager: binaries_util.BinaryManager,
                               device: Device) -> None:

    check(
        device.HasField("swift_shader"),
        AssertionError(f"Expected SwiftShader device: {device}"),
    )

    amber_path = binary_manager.get_binary_path_by_name(
        binaries_util.AMBER_NAME).path

    swift_shader_binary_and_path = binary_manager.get_binary_path_by_name(
        binaries_util.SWIFT_SHADER_NAME)
    driver_details = ""
    try:
        driver_details = host_device_util.get_driver_details(
            amber_path, swift_shader_binary_and_path.path)
    except GetDeviceDetailsError as ex:
        log(f"WARNING: Failed to get device driver details: {ex}")

    device.device_properties = driver_details

    del device.binaries[:]
    device.binaries.extend([swift_shader_binary_and_path.binary])