AudioPlaybackCaptureConfiguration.Builder


public static final class AudioPlaybackCaptureConfiguration.Builder
extends Object

java.lang.Object
   ↳ android.media.AudioPlaybackCaptureConfiguration.Builder


Builder for creating AudioPlaybackCaptureConfiguration instances.

Summary

Public constructors

Builder(MediaProjection projection)

Public methods

AudioPlaybackCaptureConfiguration.Builder addMatchingUid(int uid)

Only capture audio output by app with the matching uid.

AudioPlaybackCaptureConfiguration.Builder addMatchingUsage(int usage)

Only capture audio output with the given AudioAttributes.

AudioPlaybackCaptureConfiguration build()

Builds the configuration instance.

AudioPlaybackCaptureConfiguration.Builder excludeUid(int uid)

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

AudioPlaybackCaptureConfiguration.Builder excludeUsage(int usage)

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

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

Builder

Added in API level 29
public Builder (MediaProjection projection)

Parameters
projection MediaProjection: A MediaProjection that supports audio projection. This value cannot be null.

Public methods

addMatchingUid

Added in API level 29
public AudioPlaybackCaptureConfiguration.Builder addMatchingUid (int uid)

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.

Parameters
uid int

Returns
AudioPlaybackCaptureConfiguration.Builder This value cannot be null.

Throws
IllegalStateException if called in conjunction with excludeUid(int).

addMatchingUsage

Added in API level 29
public AudioPlaybackCaptureConfiguration.Builder addMatchingUsage (int usage)

Only capture audio output with the given AudioAttributes.

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

Returns
AudioPlaybackCaptureConfiguration.Builder This value cannot be null.

Throws
IllegalStateException if called in conjunction with excludeUsage(int).

build

Added in API level 29
public AudioPlaybackCaptureConfiguration build ()

Builds the configuration instance.

Returns
AudioPlaybackCaptureConfiguration This value cannot be null.

Throws
UnsupportedOperationException if the parameters set are incompatible.

excludeUid

Added in API level 29
public AudioPlaybackCaptureConfiguration.Builder excludeUid (int uid)

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.

Parameters
uid int

Returns
AudioPlaybackCaptureConfiguration.Builder This value cannot be null.

Throws
IllegalStateException if called in conjunction with addMatchingUid(int).

excludeUsage

Added in API level 29
public AudioPlaybackCaptureConfiguration.Builder excludeUsage (int usage)

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.

Returns
AudioPlaybackCaptureConfiguration.Builder This value cannot be null.

Throws
IllegalStateException if called in conjunction with addMatchingUsage(int).