Loading media/java/android/media/AudioAttributes.java +17 −4 Original line number Original line Diff line number Diff line Loading @@ -786,8 +786,13 @@ public final class AudioAttributes implements Parcelable { /** /** * Sets attributes as inferred from the legacy stream types. * Sets attributes as inferred from the legacy stream types. * Use this method when building an {@link AudioAttributes} instance to initialize some of * Warning: do not use this method in combination with setting any other attributes such as * the attributes by information derived from a legacy stream type. * usage, content type, flags or haptic control, as this method will overwrite (the more * accurate) information describing the use case previously set in the <code>Builder</code>. * In general, avoid using it and prefer setting usage and content type directly * with {@link #setUsage(int)} and {@link #setContentType(int)}. * <p>Use this method when building an {@link AudioAttributes} instance to initialize some * of the attributes by information derived from a legacy stream type. * @param streamType one of {@link AudioManager#STREAM_VOICE_CALL}, * @param streamType one of {@link AudioManager#STREAM_VOICE_CALL}, * {@link AudioManager#STREAM_SYSTEM}, {@link AudioManager#STREAM_RING}, * {@link AudioManager#STREAM_SYSTEM}, {@link AudioManager#STREAM_RING}, * {@link AudioManager#STREAM_MUSIC}, {@link AudioManager#STREAM_ALARM}, * {@link AudioManager#STREAM_MUSIC}, {@link AudioManager#STREAM_ALARM}, Loading @@ -799,7 +804,8 @@ public final class AudioAttributes implements Parcelable { throw new IllegalArgumentException("STREAM_ACCESSIBILITY is not a legacy stream " throw new IllegalArgumentException("STREAM_ACCESSIBILITY is not a legacy stream " + "type that was used for audio playback"); + "type that was used for audio playback"); } } return setInternalLegacyStreamType(streamType); setInternalLegacyStreamType(streamType); return this; } } /** /** Loading @@ -815,7 +821,14 @@ public final class AudioAttributes implements Parcelable { AudioProductStrategy.getAudioAttributesForStrategyWithLegacyStreamType( AudioProductStrategy.getAudioAttributesForStrategyWithLegacyStreamType( streamType); streamType); if (attributes != null) { if (attributes != null) { return new Builder(attributes).setHapticChannelsMuted(mMuteHapticChannels); mUsage = attributes.mUsage; mContentType = attributes.mContentType; mFlags = attributes.mFlags; mMuteHapticChannels = attributes.areHapticChannelsMuted(); mTags = attributes.mTags; mBundle = attributes.mBundle; mSource = attributes.mSource; return this; } } } } switch(streamType) { switch(streamType) { Loading Loading
media/java/android/media/AudioAttributes.java +17 −4 Original line number Original line Diff line number Diff line Loading @@ -786,8 +786,13 @@ public final class AudioAttributes implements Parcelable { /** /** * Sets attributes as inferred from the legacy stream types. * Sets attributes as inferred from the legacy stream types. * Use this method when building an {@link AudioAttributes} instance to initialize some of * Warning: do not use this method in combination with setting any other attributes such as * the attributes by information derived from a legacy stream type. * usage, content type, flags or haptic control, as this method will overwrite (the more * accurate) information describing the use case previously set in the <code>Builder</code>. * In general, avoid using it and prefer setting usage and content type directly * with {@link #setUsage(int)} and {@link #setContentType(int)}. * <p>Use this method when building an {@link AudioAttributes} instance to initialize some * of the attributes by information derived from a legacy stream type. * @param streamType one of {@link AudioManager#STREAM_VOICE_CALL}, * @param streamType one of {@link AudioManager#STREAM_VOICE_CALL}, * {@link AudioManager#STREAM_SYSTEM}, {@link AudioManager#STREAM_RING}, * {@link AudioManager#STREAM_SYSTEM}, {@link AudioManager#STREAM_RING}, * {@link AudioManager#STREAM_MUSIC}, {@link AudioManager#STREAM_ALARM}, * {@link AudioManager#STREAM_MUSIC}, {@link AudioManager#STREAM_ALARM}, Loading @@ -799,7 +804,8 @@ public final class AudioAttributes implements Parcelable { throw new IllegalArgumentException("STREAM_ACCESSIBILITY is not a legacy stream " throw new IllegalArgumentException("STREAM_ACCESSIBILITY is not a legacy stream " + "type that was used for audio playback"); + "type that was used for audio playback"); } } return setInternalLegacyStreamType(streamType); setInternalLegacyStreamType(streamType); return this; } } /** /** Loading @@ -815,7 +821,14 @@ public final class AudioAttributes implements Parcelable { AudioProductStrategy.getAudioAttributesForStrategyWithLegacyStreamType( AudioProductStrategy.getAudioAttributesForStrategyWithLegacyStreamType( streamType); streamType); if (attributes != null) { if (attributes != null) { return new Builder(attributes).setHapticChannelsMuted(mMuteHapticChannels); mUsage = attributes.mUsage; mContentType = attributes.mContentType; mFlags = attributes.mFlags; mMuteHapticChannels = attributes.areHapticChannelsMuted(); mTags = attributes.mTags; mBundle = attributes.mBundle; mSource = attributes.mSource; return this; } } } } switch(streamType) { switch(streamType) { Loading