Added in API level 23

CallAudioState


class CallAudioState : Parcelable
kotlin.Any
   ↳ android.telecom.CallAudioState

Encapsulates the telecom audio state, including the current audio routing, supported audio routing and mute.

Summary

Constants
static Int

Direct the audio stream through Bluetooth.

static Int

Direct the audio stream through the device's earpiece.

static Int

Direct the audio stream through the device's speakerphone.

static Int

Direct the audio stream through another device.

static Int

Direct the audio stream through a wired headset.

static Int

Direct the audio stream through the device's earpiece or wired headset if one is connected.

Inherited constants
Public constructors
CallAudioState(muted: Boolean, route: Int, supportedRouteMask: Int)

Constructor for a CallAudioState object.

Public methods
static String!

Converts the provided audio route into a human readable string representation.

Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Boolean
equals(other: Any?)

Indicates whether some other object is "equal to" this one.

BluetoothDevice!

Int

MutableCollection<BluetoothDevice!>!

Int

Boolean

String

Returns a string representation of the object.

Unit
writeToParcel(destination: Parcel, flags: Int)

Writes AudioState object into a serializeable Parcel.

Properties
static Parcelable.Creator<CallAudioState!>

Responsible for creating AudioState objects for deserialized Parcels.

Constants

ROUTE_BLUETOOTH

Added in API level 23
static val ROUTE_BLUETOOTH: Int

Direct the audio stream through Bluetooth.

Value: 2

ROUTE_EARPIECE

Added in API level 23
static val ROUTE_EARPIECE: Int

Direct the audio stream through the device's earpiece.

Value: 1

ROUTE_SPEAKER

Added in API level 23
static val ROUTE_SPEAKER: Int

Direct the audio stream through the device's speakerphone.

Value: 8

ROUTE_STREAMING

Added in API level 34
static val ROUTE_STREAMING: Int

Direct the audio stream through another device.

Value: 16

ROUTE_WIRED_HEADSET

Added in API level 23
static val ROUTE_WIRED_HEADSET: Int

Direct the audio stream through a wired headset.

Value: 4

ROUTE_WIRED_OR_EARPIECE

Added in API level 23
static val ROUTE_WIRED_OR_EARPIECE: Int

Direct the audio stream through the device's earpiece or wired headset if one is connected.

Value: 5

Public constructors

CallAudioState

Added in API level 23
CallAudioState(
    muted: Boolean,
    route: Int,
    supportedRouteMask: Int)

Constructor for a CallAudioState object.

Parameters
muted Boolean: true if the call is muted, false otherwise.
route Int: The current audio route being used. Allowed values: ROUTE_EARPIECE ROUTE_BLUETOOTH ROUTE_WIRED_HEADSET ROUTE_SPEAKER
Value is either 0 or a combination of the following:
supportedRouteMask Int: Bit mask of all routes supported by this call. This should be a bitwise combination of the following values: ROUTE_EARPIECE ROUTE_BLUETOOTH ROUTE_WIRED_HEADSET ROUTE_SPEAKER
Value is either 0 or a combination of the following:

Public methods

audioRouteToString

Added in API level 23
static fun audioRouteToString(route: Int): String!

Converts the provided audio route into a human readable string representation.

Parameters
route Int: to convert into a string.
Return
String! String representation of the provided audio route.

describeContents

Added in API level 23
fun describeContents(): Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

equals

Added in API level 23
fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getActiveBluetoothDevice

Added in API level 28
fun getActiveBluetoothDevice(): BluetoothDevice!
Return
BluetoothDevice! The BluetoothDevice through which audio is being routed. Will not be null if getRoute() returns ROUTE_BLUETOOTH.

getRoute

Added in API level 23
fun getRoute(): Int
Return
Int The current audio route being used.
Value is either 0 or a combination of the following:

getSupportedBluetoothDevices

Added in API level 28
fun getSupportedBluetoothDevices(): MutableCollection<BluetoothDevice!>!
Return
MutableCollection<BluetoothDevice!>! List of BluetoothDevices that can be used for this call.

getSupportedRouteMask

Added in API level 23
fun getSupportedRouteMask(): Int
Return
Int Bit mask of all routes supported by this call.
Value is either 0 or a combination of the following:

isMuted

Added in API level 23
fun isMuted(): Boolean
Return
Boolean true if the call is muted, false otherwise.

toString

Added in API level 23
fun toString(): String

Returns a string representation of the object.

Return
String a string representation of the object.

writeToParcel

Added in API level 23
fun writeToParcel(
    destination: Parcel,
    flags: Int
): Unit

Writes AudioState object into a serializeable Parcel.

Parameters
dest The Parcel in which the object should be written.
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 the following:

Properties

CREATOR

Added in API level 23
static val CREATOR: Parcelable.Creator<CallAudioState!>

Responsible for creating AudioState objects for deserialized Parcels.