FileDocCategorySizeDatePackage
AudioFocusInfo.javaAPI DocAndroid 5.1 API5421Thu Mar 12 22:22:30 GMT 2015android.media

AudioFocusInfo

public final class AudioFocusInfo extends Object implements android.os.Parcelable
hide
A class to encapsulate information about an audio focus owner or request.

Fields Summary
private AudioAttributes
mAttributes
private String
mClientId
private String
mPackageName
private int
mGainRequest
private int
mLossReceived
private int
mFlags
public static final Parcelable.Creator
CREATOR
Constructors Summary
AudioFocusInfo(AudioAttributes aa, String clientId, String packageName, int gainRequest, int lossReceived, int flags)
Class constructor

param
aa
param
clientId
param
packageName
param
gainRequest
param
lossReceived
param
flags

        mAttributes = aa == null ? new AudioAttributes.Builder().build() : aa;
        mClientId = clientId == null ? "" : clientId;
        mPackageName = packageName == null ? "" : packageName;
        mGainRequest = gainRequest;
        mLossReceived = lossReceived;
        mFlags = flags;
    
Methods Summary
voidclearLossReceived()

hide

 mLossReceived = 0; 
public intdescribeContents()

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

        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        AudioFocusInfo other = (AudioFocusInfo) obj;
        if (!mAttributes.equals(other.mAttributes)) {
            return false;
        }
        if (!mClientId.equals(other.mClientId)) {
            return false;
        }
        if (!mPackageName.equals(other.mPackageName)) {
            return false;
        }
        if (mGainRequest != other.mGainRequest) {
            return false;
        }
        if (mLossReceived != other.mLossReceived) {
            return false;
        }
        if (mFlags != other.mFlags) {
            return false;
        }
        return true;
    
public AudioAttributesgetAttributes()
The audio attributes for the audio focus request.

return
non-null {@link AudioAttributes}.

 return mAttributes; 
public java.lang.StringgetClientId()

 return mClientId; 
public intgetFlags()
The flags set in the audio focus request.

return
0 or a combination of {link AudioManager#AUDIOFOCUS_FLAG_DELAY_OK}, {@link AudioManager#AUDIOFOCUS_FLAG_PAUSES_ON_DUCKABLE_LOSS}, and {@link AudioManager#AUDIOFOCUS_FLAG_LOCK}.

 return mFlags; 
public intgetGainRequest()
The type of audio focus gain request.

return
one of {@link AudioManager#AUDIOFOCUS_GAIN}, {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT}, {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK}, {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE}.

 return mGainRequest; 
public intgetLossReceived()
The type of audio focus loss that was received by the {@link AudioManager.OnAudioFocusChangeListener} if one was set.

return
0 if focus wasn't lost, or one of {@link AudioManager#AUDIOFOCUS_LOSS}, {@link AudioManager#AUDIOFOCUS_LOSS_TRANSIENT} or {@link AudioManager#AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK}.

 return mLossReceived; 
public java.lang.StringgetPackageName()

 return mPackageName; 
public inthashCode()

        return Objects.hash(mAttributes, mClientId, mPackageName, mGainRequest, mFlags);
    
public voidwriteToParcel(android.os.Parcel dest, int flags)

        mAttributes.writeToParcel(dest, flags);
        dest.writeString(mClientId);
        dest.writeString(mPackageName);
        dest.writeInt(mGainRequest);
        dest.writeInt(mLossReceived);
        dest.writeInt(mFlags);