AudioBecomingNoisyManager


@UnstableApi
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!,
    backgroundLooper: Looper!,
    eventLooper: Looper!,
    listener: AudioBecomingNoisyManager.Listener!,
    clock: Clock!
)

Creates the audio becoming noisy manager.

Public functions

Unit
setEnabled(enabled: Boolean)

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

Public constructors

AudioBecomingNoisyManager

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

Creates the audio becoming noisy manager.

Parameters
context: Context!

A Context.

backgroundLooper: Looper!

A background {link Looper}.

eventLooper: Looper!

The event listener Looper.

listener: AudioBecomingNoisyManager.Listener!

The Listener

clock: Clock!

The Clock to schedule handler messages.

Public functions

setEnabled

fun setEnabled(enabled: Boolean): Unit

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

Parameters
enabled: Boolean

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