FileDocCategorySizeDatePackage
AudioState.javaAPI DocAndroid 5.1 API5695Thu Mar 12 22:22:42 GMT 2015android.telecom

AudioState

public final class AudioState extends Object implements android.os.Parcelable
Encapsulates the telecom audio state, including the current audio routing, supported audio routing and mute.
hide

Fields Summary
public static final int
ROUTE_EARPIECE
Direct the audio stream through the device's earpiece.
public static final int
ROUTE_BLUETOOTH
Direct the audio stream through Bluetooth.
public static final int
ROUTE_WIRED_HEADSET
Direct the audio stream through a wired headset.
public static final int
ROUTE_SPEAKER
Direct the audio stream through the device's speakerphone.
public static final int
ROUTE_WIRED_OR_EARPIECE
Direct the audio stream through the device's earpiece or wired headset if one is connected.
public static final int
ROUTE_ALL
Bit mask of all possible audio routes.
public final boolean
isMuted
Note: Deprecated, please do not use if possible.
public final int
route
Note: Deprecated, please do not use if possible.
public final int
supportedRouteMask
Note: Deprecated, please do not use if possible.
public static final Parcelable.Creator
CREATOR
Responsible for creating AudioState objects for deserialized Parcels.
Constructors Summary
public AudioState(boolean muted, int route, int supportedRouteMask)


           
        this.isMuted = muted;
        this.route = route;
        this.supportedRouteMask = supportedRouteMask;
    
public AudioState(AudioState state)

        isMuted = state.isMuted();
        route = state.getRoute();
        supportedRouteMask = state.getSupportedRouteMask();
    
Methods Summary
public static java.lang.StringaudioRouteToString(int route)

hide

        if (route == 0 || (route & ~ROUTE_ALL) != 0x0) {
            return "UNKNOWN";
        }

        StringBuffer buffer = new StringBuffer();
        if ((route & ROUTE_EARPIECE) == ROUTE_EARPIECE) {
            listAppend(buffer, "EARPIECE");
        }
        if ((route & ROUTE_BLUETOOTH) == ROUTE_BLUETOOTH) {
            listAppend(buffer, "BLUETOOTH");
        }
        if ((route & ROUTE_WIRED_HEADSET) == ROUTE_WIRED_HEADSET) {
            listAppend(buffer, "WIRED_HEADSET");
        }
        if ((route & ROUTE_SPEAKER) == ROUTE_SPEAKER) {
            listAppend(buffer, "SPEAKER");
        }

        return buffer.toString();
    
public intdescribeContents()
{@inheritDoc}


          
    
       
        return 0;
    
public booleanequals(java.lang.Object obj)

        if (obj == null) {
            return false;
        }
        if (!(obj instanceof AudioState)) {
            return false;
        }
        AudioState state = (AudioState) obj;
        return isMuted() == state.isMuted() && getRoute() == state.getRoute() &&
                getSupportedRouteMask() == state.getSupportedRouteMask();
    
public intgetRoute()

return
The current audio route being used.

        return route;
    
public intgetSupportedRouteMask()

return
Bit mask of all routes supported by this call.

        return supportedRouteMask;
    
public booleanisMuted()

return
{@code true} if the call is muted, false otherwise.

        return isMuted;
    
private static voidlistAppend(java.lang.StringBuffer buffer, java.lang.String str)

        if (buffer.length() > 0) {
            buffer.append(", ");
        }
        buffer.append(str);
    
public java.lang.StringtoString()

        return String.format(Locale.US,
                "[AudioState isMuted: %b, route: %s, supportedRouteMask: %s]",
                isMuted,
                audioRouteToString(route),
                audioRouteToString(supportedRouteMask));
    
public voidwriteToParcel(android.os.Parcel destination, int flags)
Writes AudioState object into a serializeable Parcel.

        destination.writeByte((byte) (isMuted ? 1 : 0));
        destination.writeInt(route);
        destination.writeInt(supportedRouteMask);