AudioStatepublic final class AudioState extends Object implements android.os.ParcelableEncapsulates the telecom audio state, including the current audio routing, supported audio
routing and mute. |
Fields Summary |
---|
public static final int | ROUTE_EARPIECEDirect the audio stream through the device's earpiece. | public static final int | ROUTE_BLUETOOTHDirect the audio stream through Bluetooth. | public static final int | ROUTE_WIRED_HEADSETDirect the audio stream through a wired headset. | public static final int | ROUTE_SPEAKERDirect the audio stream through the device's speakerphone. | public static final int | ROUTE_WIRED_OR_EARPIECEDirect the audio stream through the device's earpiece or wired headset if one is
connected. | public static final int | ROUTE_ALLBit mask of all possible audio routes. | public final boolean | isMutedNote: Deprecated, please do not use if possible. | public final int | routeNote: Deprecated, please do not use if possible. | public final int | supportedRouteMaskNote: Deprecated, please do not use if possible. | public static final Parcelable.Creator | CREATORResponsible 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.String | audioRouteToString(int route)
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 int | describeContents(){@inheritDoc}
return 0;
| public boolean | equals(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 int | getRoute()
return route;
| public int | getSupportedRouteMask()
return supportedRouteMask;
| public boolean | isMuted()
return isMuted;
| private static void | listAppend(java.lang.StringBuffer buffer, java.lang.String str)
if (buffer.length() > 0) {
buffer.append(", ");
}
buffer.append(str);
| public java.lang.String | toString()
return String.format(Locale.US,
"[AudioState isMuted: %b, route: %s, supportedRouteMask: %s]",
isMuted,
audioRouteToString(route),
audioRouteToString(supportedRouteMask));
| public void | writeToParcel(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);
|
|