AudioBecomingNoisyManager


@UnstableApi
public final class AudioBecomingNoisyManager


Utility class to detect when audio is becoming noisy.

The class must be used from a single thread. This can be the main thread as all blocking operations are internally handled on the background Looper thread provided in the constructor.

Summary

Nested types

Listener for becoming noisy events.

Public constructors

AudioBecomingNoisyManager(
    Context context,
    Looper backgroundLooper,
    Looper eventLooper,
    AudioBecomingNoisyManager.Listener listener,
    Clock clock
)

Creates the audio becoming noisy manager.

Public methods

void
setEnabled(boolean enabled)

Enables the AudioBecomingNoisyManager which calls onAudioBecomingNoisy upon receiving an intent of ACTION_AUDIO_BECOMING_NOISY.

Public constructors

AudioBecomingNoisyManager

public AudioBecomingNoisyManager(
    Context context,
    Looper backgroundLooper,
    Looper eventLooper,
    AudioBecomingNoisyManager.Listener listener,
    Clock clock
)

Creates the audio becoming noisy manager.

Parameters
Context context

A Context.

Looper backgroundLooper

A background {link Looper}.

Looper eventLooper

The event listener Looper.

AudioBecomingNoisyManager.Listener listener

The Listener

Clock clock

The Clock to schedule handler messages.

Public methods

setEnabled

public void setEnabled(boolean enabled)

Enables the AudioBecomingNoisyManager which calls onAudioBecomingNoisy upon receiving an intent of ACTION_AUDIO_BECOMING_NOISY.

Parameters
boolean enabled

True if the listener should be notified when audio is becoming noisy.