@MustBeDocumented
@Retention(value = AnnotationRetention.RUNTIME)
@Target(allowedTargets = [AnnotationTarget.VALUE_PARAMETER])
public annotation Device


Qualifier annotation used for multi-device orchestration. Instructs the JUnit 5 extension which connected device characteristics to resolve.

A BackupRestoreController parameter that asks for a serial number, through serial, a binding of role or a system property, gets the device with that serial number. The other controller parameters of a method or constructor get, in the order of the parameters, the first online device by serial number that matches them and that no other parameter asks for or got before them. When every device that matches a parameter is taken, the parameter shares the first one.

Summary

Public constructors

Device(@NonNull String role, int api, @NonNull String serial)

Public methods

final int

The requested SDK API level (e.g. 31, 34).

final @NonNull String

The role of the device in a multi-device test, such as "source" or "target".

final @NonNull String

The specific hardware/emulator serial number to match, or a name that the system property androidx.test.backup.device.serial.<serial> binds to a serial number.

Public constructors

Device

Added in 1.0.0-alpha03
public Device(@NonNull String role, int api, @NonNull String serial)

Public methods

getApi

public final int getApi()

The requested SDK API level (e.g. 31, 34). Defaults to 0 (any matches).

getRole

public final @NonNull String getRole()

The role of the device in a multi-device test, such as "source" or "target". The system property androidx.test.backup.device.serial.<role> binds the role to the device with that serial number, whatever serial and the other device properties ask for. Without the property, the role doesn't change which device is selected. Defaults to "".

getSerial

public final @NonNull String getSerial()

The specific hardware/emulator serial number to match, or a name that the system property androidx.test.backup.device.serial.<serial> binds to a serial number. The system properties androidx.test.backup.device.serials and androidx.test.backup.device.serial take precedence over a literal serial number. Defaults to "" (any match).