Added in API level 29

Builder


class Builder
kotlin.Any
   ↳ android.media.AudioPlaybackCaptureConfiguration.Builder

Builder for creating AudioPlaybackCaptureConfiguration instances.

Summary

Public constructors
Builder(projection: MediaProjection)

Public methods
AudioPlaybackCaptureConfiguration.Builder

Only capture audio output by app with the matching uid.

AudioPlaybackCaptureConfiguration.Builder

Only capture audio output with the given AudioAttributes.

AudioPlaybackCaptureConfiguration

Builds the configuration instance.

AudioPlaybackCaptureConfiguration.Builder

Only capture audio output by apps that do not have the matching uid.

AudioPlaybackCaptureConfiguration.Builder
excludeUsage(usage: Int)

Only capture audio output that does not match the given AudioAttributes.

Public constructors

Builder

Added in API level 29
Builder(projection: MediaProjection)
Parameters
projection MediaProjection: A MediaProjection that supports audio projection. This value cannot be null.

Public methods

addMatchingUid

Added in API level 29
fun addMatchingUid(uid: Int): AudioPlaybackCaptureConfiguration.Builder

Only capture audio output by app with the matching uid.

If called multiple times, will capture audio output by apps whose uid is any of the given uids.

Return
AudioPlaybackCaptureConfiguration.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if called in conjunction with excludeUid(int).

addMatchingUsage

Added in API level 29
fun addMatchingUsage(usage: Int): AudioPlaybackCaptureConfiguration.Builder

Only capture audio output with the given AudioAttributes.

If called multiple times, will capture audio output that matches any of the given attributes.

Parameters
usage Int: Value is android.media.AudioAttributes#USAGE_UNKNOWN, android.media.AudioAttributes#USAGE_MEDIA, android.media.AudioAttributes#USAGE_VOICE_COMMUNICATION, android.media.AudioAttributes#USAGE_VOICE_COMMUNICATION_SIGNALLING, android.media.AudioAttributes#USAGE_ALARM, android.media.AudioAttributes#USAGE_NOTIFICATION, android.media.AudioAttributes#USAGE_NOTIFICATION_RINGTONE, android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_REQUEST, android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_INSTANT, android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_DELAYED, android.media.AudioAttributes#USAGE_NOTIFICATION_EVENT, android.media.AudioAttributes#USAGE_ASSISTANCE_ACCESSIBILITY, android.media.AudioAttributes#USAGE_ASSISTANCE_NAVIGATION_GUIDANCE, android.media.AudioAttributes#USAGE_ASSISTANCE_SONIFICATION, android.media.AudioAttributes#USAGE_GAME, android.media.AudioAttributes#USAGE_ASSISTANT, android.media.AudioAttributes.USAGE_CALL_ASSISTANT, android.media.AudioAttributes.USAGE_EMERGENCY, android.media.AudioAttributes.USAGE_SAFETY, android.media.AudioAttributes.USAGE_VEHICLE_STATUS, android.media.AudioAttributes.USAGE_ANNOUNCEMENT, or android.media.AudioAttributes.USAGE_SPEAKER_CLEANUP
Return
AudioPlaybackCaptureConfiguration.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if called in conjunction with excludeUsage(int).

build

Added in API level 29
fun build(): AudioPlaybackCaptureConfiguration

Builds the configuration instance.

Return
AudioPlaybackCaptureConfiguration This value cannot be null.
Exceptions
java.lang.UnsupportedOperationException if the parameters set are incompatible.

excludeUid

Added in API level 29
fun excludeUid(uid: Int): AudioPlaybackCaptureConfiguration.Builder

Only capture audio output by apps that do not have the matching uid.

If called multiple times, will capture audio output by apps whose uid is not any of the given uids.

Return
AudioPlaybackCaptureConfiguration.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if called in conjunction with addMatchingUid(int).

excludeUsage

Added in API level 29
fun excludeUsage(usage: Int): AudioPlaybackCaptureConfiguration.Builder

Only capture audio output that does not match the given AudioAttributes.

If called multiple times, will capture audio output that does not match any of the given attributes.

Parameters
usage Int: Value is android.media.AudioAttributes#USAGE_UNKNOWN, android.media.AudioAttributes#USAGE_MEDIA, android.media.AudioAttributes#USAGE_VOICE_COMMUNICATION, android.media.AudioAttributes#USAGE_VOICE_COMMUNICATION_SIGNALLING, android.media.AudioAttributes#USAGE_ALARM, android.media.AudioAttributes#USAGE_NOTIFICATION, android.media.AudioAttributes#USAGE_NOTIFICATION_RINGTONE, android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_REQUEST, android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_INSTANT, android.media.AudioAttributes#USAGE_NOTIFICATION_COMMUNICATION_DELAYED, android.media.AudioAttributes#USAGE_NOTIFICATION_EVENT, android.media.AudioAttributes#USAGE_ASSISTANCE_ACCESSIBILITY, android.media.AudioAttributes#USAGE_ASSISTANCE_NAVIGATION_GUIDANCE, android.media.AudioAttributes#USAGE_ASSISTANCE_SONIFICATION, android.media.AudioAttributes#USAGE_GAME, android.media.AudioAttributes#USAGE_ASSISTANT, android.media.AudioAttributes.USAGE_CALL_ASSISTANT, android.media.AudioAttributes.USAGE_EMERGENCY, android.media.AudioAttributes.USAGE_SAFETY, android.media.AudioAttributes.USAGE_VEHICLE_STATUS, android.media.AudioAttributes.USAGE_ANNOUNCEMENT, or android.media.AudioAttributes.USAGE_SPEAKER_CLEANUP
Return
AudioPlaybackCaptureConfiguration.Builder This value cannot be null.
Exceptions
java.lang.IllegalStateException if called in conjunction with addMatchingUsage(int).