@Implements(value=android.media.session.MediaController.class, minSdk=21) public class ShadowMediaController extends Object
MediaController
.Constructor | Description |
---|---|
ShadowMediaController() |
Modifier and Type | Method | Description |
---|---|---|
void |
executeOnMetadataChanged(MediaMetadata metadata) |
Executes all registered onMetadataChanged callbacks.
|
void |
executeOnPlaybackStateChanged(PlaybackState playbackState) |
Executes all registered onPlaybackStateChanged callbacks.
|
List<MediaController.Callback> |
getCallbacks() |
Gets the callbacks registered to MediaController.
|
protected MediaMetadata |
getMetadata() |
Gets the mediaMetadata set via
setMetadata(android.media.MediaMetadata) . |
protected PlaybackState |
getPlaybackState() |
Gets the playbackState set via
setPlaybackState(android.media.session.PlaybackState) . |
protected void |
registerCallback(MediaController.Callback callback) |
Register callback and store it in the shadow to make it easier to check the state of the
registered callbacks.
|
void |
setMetadata(MediaMetadata mediaMetadata) |
Saves the mediaMetadata to control the return value of
MediaController.getMetadata() . |
void |
setPackageName(String packageName) |
Saves the package name for use inside the shadow.
|
void |
setPlaybackState(PlaybackState playbackState) |
Saves the playbackState to control the return value of
MediaController.getPlaybackState() . |
protected void |
unregisterCallback(MediaController.Callback callback) |
Unregister callback and remove it from the shadow to make it easier to check the state of the
registered callbacks.
|
public void setPackageName(String packageName)
public void setPlaybackState(PlaybackState playbackState)
MediaController.getPlaybackState()
.@Implementation protected PlaybackState getPlaybackState()
setPlaybackState(android.media.session.PlaybackState)
.public void setMetadata(MediaMetadata mediaMetadata)
MediaController.getMetadata()
.@Implementation protected MediaMetadata getMetadata()
setMetadata(android.media.MediaMetadata)
.@Implementation protected void registerCallback(MediaController.Callback callback)
@Implementation protected void unregisterCallback(MediaController.Callback callback)
public List<MediaController.Callback> getCallbacks()
public void executeOnPlaybackStateChanged(PlaybackState playbackState)
public void executeOnMetadataChanged(MediaMetadata metadata)