@Implements(value=android.media.AudioManager.class) public class ShadowAudioManager extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ShadowAudioManager.AudioFocusRequest |
Modifier and Type | Field and Description |
---|---|
static int[] |
ALL_STREAMS |
static int |
DEFAULT_MAX_VOLUME |
static int |
DEFAULT_VOLUME |
static int |
FLAG_NO_ACTION |
static int |
INVALID_VOLUME |
static int |
MAX_VOLUME_MUSIC_DTMF |
Constructor and Description |
---|
ShadowAudioManager() |
Modifier and Type | Method and Description |
---|---|
protected int |
abandonAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener l) |
protected int |
abandonAudioFocusRequest(android.media.AudioFocusRequest audioFocusRequest)
Provides a mock like interface for the abandonAudioFocusRequest method by storing the request object for later inspection and returning the value specified in setNextFocusRequestResponse.
|
protected java.util.List<android.media.AudioPlaybackConfiguration> |
getActivePlaybackConfigurations() |
android.media.AudioManager.OnAudioFocusChangeListener |
getLastAbandonedAudioFocusListener() |
android.media.AudioFocusRequest |
getLastAbandonedAudioFocusRequest() |
ShadowAudioManager.AudioFocusRequest |
getLastAudioFocusRequest() |
protected int |
getMode() |
protected int |
getRingerMode() |
protected int |
getStreamMaxVolume(int streamType) |
protected int |
getStreamVolume(int streamType) |
protected boolean |
isBluetoothA2dpOn() |
protected boolean |
isBluetoothScoOn() |
protected boolean |
isMicrophoneMute() |
protected boolean |
isMusicActive() |
protected boolean |
isSpeakerphoneOn() |
static boolean |
isValidRingerMode(int ringerMode) |
protected boolean |
isWiredHeadsetOn() |
protected int |
requestAudioFocus(android.media.AudioFocusRequest audioFocusRequest)
Provides a mock like interface for the requestAudioFocus method by storing the request object for later inspection and returning the value specified in setNextFocusRequestResponse.
|
protected int |
requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener l,
int streamType,
int durationHint) |
void |
setActivePlaybackConfigurationsFor(java.util.List<android.media.AudioAttributes> audioAttributes)
Sets active playback configurations that will be served by
AudioManager.getActivePlaybackConfigurations() . |
protected void |
setBluetoothA2dpOn(boolean on) |
protected void |
setBluetoothScoOn(boolean isBluetoothScoOn) |
void |
setIsMusicActive(boolean isMusicActive) |
protected void |
setMicrophoneMute(boolean on) |
protected void |
setMode(int mode) |
void |
setNextFocusRequestResponse(int nextResponseValue) |
protected void |
setRingerMode(int ringerMode) |
protected void |
setSpeakerphoneOn(boolean on) |
void |
setStreamMaxVolume(int streamMaxVolume) |
void |
setStreamVolume(int streamVolume) |
protected void |
setStreamVolume(int streamType,
int index,
int flags) |
protected void |
setWiredHeadsetOn(boolean on) |
public static final int MAX_VOLUME_MUSIC_DTMF
public static final int DEFAULT_MAX_VOLUME
public static final int DEFAULT_VOLUME
public static final int INVALID_VOLUME
public static final int FLAG_NO_ACTION
public static final int[] ALL_STREAMS
@Implementation protected int getStreamMaxVolume(int streamType)
@Implementation protected int getStreamVolume(int streamType)
@Implementation protected void setStreamVolume(int streamType, int index, int flags)
@Implementation protected int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener l, int streamType, int durationHint)
@Implementation(minSdk=26) protected int requestAudioFocus(android.media.AudioFocusRequest audioFocusRequest)
Provides a mock like interface for the requestAudioFocus method by storing the request object for later inspection and returning the value specified in setNextFocusRequestResponse.
@Implementation protected int abandonAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener l)
@Implementation(minSdk=26) protected int abandonAudioFocusRequest(android.media.AudioFocusRequest audioFocusRequest)
Provides a mock like interface for the abandonAudioFocusRequest method by storing the request object for later inspection and returning the value specified in setNextFocusRequestResponse.
@Implementation protected int getRingerMode()
@Implementation protected void setRingerMode(int ringerMode)
public static boolean isValidRingerMode(int ringerMode)
@Implementation protected void setMode(int mode)
@Implementation protected int getMode()
public void setStreamMaxVolume(int streamMaxVolume)
public void setStreamVolume(int streamVolume)
@Implementation protected void setWiredHeadsetOn(boolean on)
@Implementation protected boolean isWiredHeadsetOn()
@Implementation protected void setBluetoothA2dpOn(boolean on)
@Implementation protected boolean isBluetoothA2dpOn()
@Implementation protected void setSpeakerphoneOn(boolean on)
@Implementation protected boolean isSpeakerphoneOn()
@Implementation protected void setMicrophoneMute(boolean on)
@Implementation protected boolean isMicrophoneMute()
@Implementation protected boolean isBluetoothScoOn()
@Implementation protected void setBluetoothScoOn(boolean isBluetoothScoOn)
@Implementation protected boolean isMusicActive()
@Implementation(minSdk=26) protected java.util.List<android.media.AudioPlaybackConfiguration> getActivePlaybackConfigurations()
public void setActivePlaybackConfigurationsFor(java.util.List<android.media.AudioAttributes> audioAttributes)
Sets active playback configurations that will be served by AudioManager.getActivePlaybackConfigurations()
.
Note that there is no public AudioPlaybackConfiguration
constructor, so the configurations returned are specified by their audio attributes only.
public void setIsMusicActive(boolean isMusicActive)
public ShadowAudioManager.AudioFocusRequest getLastAudioFocusRequest()
public void setNextFocusRequestResponse(int nextResponseValue)
public android.media.AudioManager.OnAudioFocusChangeListener getLastAbandonedAudioFocusListener()
public android.media.AudioFocusRequest getLastAbandonedAudioFocusRequest()