Android APIs
public final class

CallAudioState

extends Object
implements Parcelable
java.lang.Object
   ↳ android.telecom.CallAudioState

Class Overview

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

Summary

Constants
int ROUTE_BLUETOOTH Direct the audio stream through Bluetooth.
int ROUTE_EARPIECE Direct the audio stream through the device's earpiece.
int ROUTE_SPEAKER Direct the audio stream through the device's speakerphone.
int ROUTE_WIRED_HEADSET Direct the audio stream through a wired headset.
int ROUTE_WIRED_OR_EARPIECE Direct the audio stream through the device's earpiece or wired headset if one is connected.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<CallAudioState> CREATOR Responsible for creating AudioState objects for deserialized Parcels.
Public Constructors
CallAudioState(boolean muted, int route, int supportedRouteMask)
Constructor for a CallAudioState object.
Public Methods
static String audioRouteToString(int route)
Converts the provided audio route into a human readable string representation.
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
boolean equals(Object obj)
Compares this instance with the specified object and indicates if they are equal.
int getRoute()
int getSupportedRouteMask()
boolean isMuted()
String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel destination, int flags)
Writes AudioState object into a serializeable Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int ROUTE_BLUETOOTH

Added in API level 23

Direct the audio stream through Bluetooth.

Constant Value: 2 (0x00000002)

public static final int ROUTE_EARPIECE

Added in API level 23

Direct the audio stream through the device's earpiece.

Constant Value: 1 (0x00000001)

public static final int ROUTE_SPEAKER

Added in API level 23

Direct the audio stream through the device's speakerphone.

Constant Value: 8 (0x00000008)

public static final int ROUTE_WIRED_HEADSET

Added in API level 23

Direct the audio stream through a wired headset.

Constant Value: 4 (0x00000004)

public static final int ROUTE_WIRED_OR_EARPIECE

Added in API level 23

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

Constant Value: 5 (0x00000005)

Fields

public static final Creator<CallAudioState> CREATOR

Added in API level 23

Responsible for creating AudioState objects for deserialized Parcels.

Public Constructors

public CallAudioState (boolean muted, int route, int supportedRouteMask)

Added in API level 23

Constructor for a CallAudioState object.

Parameters
muted true if the call is muted, false otherwise.
route The current audio route being used. Allowed values: ROUTE_EARPIECE ROUTE_BLUETOOTH ROUTE_WIRED_HEADSET ROUTE_SPEAKER
supportedRouteMask 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

Public Methods

public static String audioRouteToString (int route)

Added in API level 23

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

Parameters
route to convert into a string.
Returns
  • String representation of the provided audio route.

public int describeContents ()

Added in API level 23

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

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public boolean equals (Object obj)

Added in API level 23

Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.

The default implementation returns true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

The general contract for the equals and hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

Parameters
obj the object to compare this instance with.
Returns
  • true if the specified object is equal to this Object; false otherwise.

public int getRoute ()

Added in API level 23

Returns
  • The current audio route being used.

public int getSupportedRouteMask ()

Added in API level 23

Returns
  • Bit mask of all routes supported by this call.

public boolean isMuted ()

Added in API level 23

Returns
  • true if the call is muted, false otherwise.

public String toString ()

Added in API level 23

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel destination, int flags)

Added in API level 23

Writes AudioState object into a serializeable Parcel.

Parameters
destination The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.