Added in API level 34

VirtualDevice


class VirtualDevice : Parcelable
kotlin.Any
   ↳ android.companion.virtual.VirtualDevice

Details of a particular virtual device.

Read-only device representation exposing the properties of an existing virtual device.

Summary

Inherited constants
Public methods
Int

Int

Returns the unique ID of the virtual device.

IntArray

Returns the IDs of all virtual displays that belong to this device, if any.

CharSequence?

Returns the human-readable name of the virtual device, if defined, which is suitable to be shown in UI.

String?

Returns the name of the virtual device (optionally) provided during its creation.

String?

Returns the persistent identifier of this virtual device, if any.

Boolean

Returns whether this device may have custom sensors.

String

Returns a string representation of the object.

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<VirtualDevice!>

Public methods

describeContents

Added in API level 34
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getDeviceId

Added in API level 34
fun getDeviceId(): Int

Returns the unique ID of the virtual device.

This identifier corresponds to Context#getDeviceId() and can be used to access device-specific system capabilities.

This identifier is ephemeral and should not be used for persisting any data per device.

getDisplayIds

Added in API level 35
fun getDisplayIds(): IntArray

Returns the IDs of all virtual displays that belong to this device, if any.

The actual android.view.Display objects can be obtained by passing the returned IDs to android.hardware.display.DisplayManager#getDisplay(int).

Return
IntArray This value cannot be null.

getDisplayName

Added in API level 35
fun getDisplayName(): CharSequence?

Returns the human-readable name of the virtual device, if defined, which is suitable to be shown in UI.

Return
CharSequence? This value may be null.

getName

Added in API level 34
fun getName(): String?

Returns the name of the virtual device (optionally) provided during its creation.

Return
String? This value may be null.

getPersistentDeviceId

Added in API level 35
fun getPersistentDeviceId(): String?

Returns the persistent identifier of this virtual device, if any.

If there is no stable identifier for this virtual device, then this returns null.

This identifier may correspond to a physical device. In that case it remains valid for as long as that physical device is associated with the host device and may be used to persist data per device.

This identifier may not be unique across virtual devices, in case there are more than one virtual devices corresponding to the same physical device.

hasCustomSensorSupport

Added in API level 35
fun hasCustomSensorSupport(): Boolean

Returns whether this device may have custom sensors.

Returning true does not necessarily mean that this device has sensors, it only means that a android.hardware.SensorManager instance created from a Context associated with this device will return this device's sensors, if any.

toString

Added in API level 34
fun toString(): String

Returns a string representation of the object.

Return
String This value cannot be null.

writeToParcel

Added in API level 34
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 34
static val CREATOR: Parcelable.Creator<VirtualDevice!>