Fields Summary |
---|
private static final String | TAG |
public static final int | CONTENT_TYPE_UNKNOWNContent type value to use when the content type is unknown, or other than the ones defined. |
public static final int | CONTENT_TYPE_SPEECHContent type value to use when the content type is speech. |
public static final int | CONTENT_TYPE_MUSICContent type value to use when the content type is music. |
public static final int | CONTENT_TYPE_MOVIEContent type value to use when the content type is a soundtrack, typically accompanying
a movie or TV program. |
public static final int | CONTENT_TYPE_SONIFICATIONContent type value to use when the content type is a sound used to accompany a user
action, such as a beep or sound effect expressing a key click, or event, such as the
type of a sound for a bonus being received in a game. These sounds are mostly synthesized
or short Foley sounds. |
public static final int | USAGE_UNKNOWNUsage value to use when the usage is unknown. |
public static final int | USAGE_MEDIAUsage value to use when the usage is media, such as music, or movie
soundtracks. |
public static final int | USAGE_VOICE_COMMUNICATIONUsage value to use when the usage is voice communications, such as telephony
or VoIP. |
public static final int | USAGE_VOICE_COMMUNICATION_SIGNALLINGUsage value to use when the usage is in-call signalling, such as with
a "busy" beep, or DTMF tones. |
public static final int | USAGE_ALARMUsage value to use when the usage is an alarm (e.g. wake-up alarm). |
public static final int | USAGE_NOTIFICATIONUsage value to use when the usage is notification. See other
notification usages for more specialized uses. |
public static final int | USAGE_NOTIFICATION_RINGTONEUsage value to use when the usage is telephony ringtone. |
public static final int | USAGE_NOTIFICATION_COMMUNICATION_REQUESTUsage value to use when the usage is a request to enter/end a
communication, such as a VoIP communication or video-conference. |
public static final int | USAGE_NOTIFICATION_COMMUNICATION_INSTANTUsage value to use when the usage is notification for an "instant"
communication such as a chat, or SMS. |
public static final int | USAGE_NOTIFICATION_COMMUNICATION_DELAYEDUsage value to use when the usage is notification for a
non-immediate type of communication such as e-mail. |
public static final int | USAGE_NOTIFICATION_EVENTUsage value to use when the usage is to attract the user's attention,
such as a reminder or low battery warning. |
public static final int | USAGE_ASSISTANCE_ACCESSIBILITYUsage value to use when the usage is for accessibility, such as with
a screen reader. |
public static final int | USAGE_ASSISTANCE_NAVIGATION_GUIDANCEUsage value to use when the usage is driving or navigation directions. |
public static final int | USAGE_ASSISTANCE_SONIFICATIONUsage value to use when the usage is sonification, such as with user
interface sounds. |
public static final int | USAGE_GAMEUsage value to use when the usage is for game audio. |
public static final int | USAGE_VIRTUAL_SOURCE |
public static final int | FLAG_AUDIBILITY_ENFORCEDFlag defining a behavior where the audibility of the sound will be ensured by the system. |
public static final int | FLAG_SECURE |
public static final int | FLAG_SCO |
public static final int | FLAG_BEACON |
public static final int | FLAG_HW_AV_SYNCFlag requesting the use of an output stream supporting hardware A/V synchronization. |
public static final int | FLAG_HW_HOTWORD |
private static final int | FLAG_ALL |
private static final int | FLAG_ALL_PUBLIC |
private int | mUsage |
private int | mContentType |
private int | mSource |
private int | mFlags |
private HashSet | mTags |
private String | mFormattedTags |
public static final int | FLATTEN_TAGS |
private static final int | ALL_PARCEL_FLAGSWhen adding tags for writeToParcel(Parcel, int), add them in the list of flags (| NEW_FLAG) |
public static final Parcelable.Creator | CREATOR |
Methods Summary |
---|
public int | describeContents()
return 0;
|
public boolean | equals(java.lang.Object o)
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AudioAttributes that = (AudioAttributes) o;
return ((mContentType == that.mContentType)
&& (mFlags == that.mFlags)
&& (mSource == that.mSource)
&& (mUsage == that.mUsage)
//mFormattedTags is never null due to assignment in Builder or unmarshalling
&& (mFormattedTags.equals(that.mFormattedTags)));
|
public int | getAllFlags()
return (mFlags & FLAG_ALL);
|
public int | getCapturePreset()
return mSource;
|
public int | getContentType()Return the content type.
return mContentType;
|
public int | getFlags()Return the flags.
// only return the flags that are public
return (mFlags & (FLAG_ALL_PUBLIC));
|
public java.util.Set | getTags()
return Collections.unmodifiableSet(mTags);
|
public int | getUsage()Return the usage.
return mUsage;
|
public int | hashCode()
return Objects.hash(mContentType, mFlags, mSource, mUsage, mFormattedTags);
|
public static int | toLegacyStreamType(android.media.AudioAttributes aa)
// flags to stream type mapping
if ((aa.getFlags() & FLAG_AUDIBILITY_ENFORCED) == FLAG_AUDIBILITY_ENFORCED) {
return AudioSystem.STREAM_SYSTEM_ENFORCED;
}
if ((aa.getFlags() & FLAG_SCO) == FLAG_SCO) {
return AudioSystem.STREAM_BLUETOOTH_SCO;
}
// usage to stream type mapping
switch (aa.getUsage()) {
case USAGE_MEDIA:
case USAGE_GAME:
case USAGE_ASSISTANCE_ACCESSIBILITY:
case USAGE_ASSISTANCE_NAVIGATION_GUIDANCE:
return AudioSystem.STREAM_MUSIC;
case USAGE_ASSISTANCE_SONIFICATION:
return AudioSystem.STREAM_SYSTEM;
case USAGE_VOICE_COMMUNICATION:
return AudioSystem.STREAM_VOICE_CALL;
case USAGE_VOICE_COMMUNICATION_SIGNALLING:
return AudioSystem.STREAM_DTMF;
case USAGE_ALARM:
return AudioSystem.STREAM_ALARM;
case USAGE_NOTIFICATION_RINGTONE:
return AudioSystem.STREAM_RING;
case USAGE_NOTIFICATION:
case USAGE_NOTIFICATION_COMMUNICATION_REQUEST:
case USAGE_NOTIFICATION_COMMUNICATION_INSTANT:
case USAGE_NOTIFICATION_COMMUNICATION_DELAYED:
case USAGE_NOTIFICATION_EVENT:
return AudioSystem.STREAM_NOTIFICATION;
case USAGE_UNKNOWN:
default:
return AudioSystem.STREAM_MUSIC;
}
|
public java.lang.String | toString()
return new String("AudioAttributes:"
+ " usage=" + mUsage
+ " content=" + mContentType
+ " flags=0x" + Integer.toHexString(mFlags).toUpperCase()
+ " tags=" + mFormattedTags);
|
public static int | usageForLegacyStreamType(int streamType)
switch(streamType) {
case AudioSystem.STREAM_VOICE_CALL:
return USAGE_VOICE_COMMUNICATION;
case AudioSystem.STREAM_SYSTEM_ENFORCED:
case AudioSystem.STREAM_SYSTEM:
return USAGE_ASSISTANCE_SONIFICATION;
case AudioSystem.STREAM_RING:
return USAGE_NOTIFICATION_RINGTONE;
case AudioSystem.STREAM_MUSIC:
return USAGE_MEDIA;
case AudioSystem.STREAM_ALARM:
return USAGE_ALARM;
case AudioSystem.STREAM_NOTIFICATION:
return USAGE_NOTIFICATION;
case AudioSystem.STREAM_BLUETOOTH_SCO:
return USAGE_VOICE_COMMUNICATION;
case AudioSystem.STREAM_DTMF:
return USAGE_VOICE_COMMUNICATION_SIGNALLING;
case AudioSystem.STREAM_TTS:
return USAGE_ASSISTANCE_ACCESSIBILITY;
default:
return USAGE_UNKNOWN;
}
|
public java.lang.String | usageToString()
return usageToString(mUsage);
|
public static java.lang.String | usageToString(int usage)
switch(usage) {
case USAGE_UNKNOWN:
return new String("USAGE_UNKNOWN");
case USAGE_MEDIA:
return new String("USAGE_MEDIA");
case USAGE_VOICE_COMMUNICATION:
return new String("USAGE_VOICE_COMMUNICATION");
case USAGE_VOICE_COMMUNICATION_SIGNALLING:
return new String("USAGE_VOICE_COMMUNICATION");
case USAGE_ALARM:
return new String("USAGE_ALARM");
case USAGE_NOTIFICATION:
return new String("USAGE_NOTIFICATION");
case USAGE_NOTIFICATION_RINGTONE:
return new String("USAGE_NOTIFICATION");
case USAGE_NOTIFICATION_COMMUNICATION_REQUEST:
return new String("USAGE_NOTIFICATION");
case USAGE_NOTIFICATION_COMMUNICATION_INSTANT:
return new String("USAGE_NOTIFICATION_COMMUNICATION_INSTANT");
case USAGE_NOTIFICATION_COMMUNICATION_DELAYED:
return new String("USAGE_NOTIFICATION_COMMUNICATION_DELAYED");
case USAGE_NOTIFICATION_EVENT:
return new String("USAGE_NOTIFICATION_EVENT");
case USAGE_ASSISTANCE_ACCESSIBILITY:
return new String("USAGE_ASSISTANCE_ACCESSIBILITY");
case USAGE_ASSISTANCE_NAVIGATION_GUIDANCE:
return new String("USAGE_ASSISTANCE_NAVIGATION_GUIDANCE");
case USAGE_ASSISTANCE_SONIFICATION:
return new String("USAGE_ASSISTANCE_SONIFICATION");
case USAGE_GAME:
return new String("USAGE_GAME");
default:
return new String("unknown usage " + usage);
}
|
public void | writeToParcel(android.os.Parcel dest, int flags)
dest.writeInt(mUsage);
dest.writeInt(mContentType);
dest.writeInt(mSource);
dest.writeInt(mFlags);
dest.writeInt(flags & ALL_PARCEL_FLAGS);
if ((flags & FLATTEN_TAGS) == 0) {
String[] tagsArray = new String[mTags.size()];
mTags.toArray(tagsArray);
dest.writeStringArray(tagsArray);
} else if ((flags & FLATTEN_TAGS) == FLATTEN_TAGS) {
dest.writeString(mFormattedTags);
}
|