@MustBeDocumented
@Retention(value = AnnotationRetention.RUNTIME)
@Target(allowedTargets = [AnnotationTarget.VALUE_PARAMETER])
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(role: String, api: Int, serial: String)

Public properties

Int

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

String

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

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
Device(role: String = "", api: Int = 0, serial: String = "")

Public properties

api

val api: Int

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

role

val role: String

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 "".

serial

val serial: 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. 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).