Methods Summary |
---|
private void | deliverDescriptorChanged()
mPendingDescriptorChange = false;
if (mCallback != null) {
mCallback.onDescriptorChanged(this, mDescriptor);
}
|
private void | deliverDiscoveryRequestChanged()
mPendingDiscoveryRequestChange = false;
onDiscoveryRequestChanged(mDiscoveryRequest);
|
public final android.content.Context | getContext()Gets the context of the media route provider.
return mContext;
|
public final MediaRouteProviderDescriptor | getDescriptor()Gets the provider's descriptor.
The descriptor describes the state of the media route provider and
the routes that it publishes. Watch for changes to the descriptor
by registering a {@link Callback callback} with {@link #setCallback}.
return mDescriptor;
|
public final MediaRouteDiscoveryRequest | getDiscoveryRequest()Gets the current discovery request which informs the provider about the
kinds of routes to discover and whether to perform active scanning.
return mDiscoveryRequest;
|
public final android.os.Handler | getHandler()Gets the provider's handler which is associated with the main thread.
return mHandler;
|
public final android.support.v7.media.MediaRouteProvider$ProviderMetadata | getMetadata()Gets some metadata about the provider's implementation.
return mMetadata;
|
public android.support.v7.media.MediaRouteProvider$RouteController | onCreateRouteController(java.lang.String routeId)Called by the media router to obtain a route controller for a particular route.
The media router will invoke the {@link RouteController#onRelease} method of the route
controller when it is no longer needed to allow it to free its resources.
return null;
|
public void | onDiscoveryRequestChanged(MediaRouteDiscoveryRequest request)Called by the media router when the {@link MediaRouteDiscoveryRequest discovery request}
has changed.
Whenever an applications calls {@link MediaRouter#addCallback} to register
a callback, it also provides a selector to specify the kinds of routes that
it is interested in. The media router combines all of these selectors together
to generate a {@link MediaRouteDiscoveryRequest} and notifies each provider when a change
occurs by calling {@link #setDiscoveryRequest} which posts a message to invoke
this method asynchronously.
The provider should examine the {@link MediaControlIntent media control categories}
in the discovery request's {@link MediaRouteSelector selector} to determine what
kinds of routes it should try to discover and whether it should perform active
or passive scans. In many cases, the provider may be able to save power by
determining that the selector does not contain any categories that it supports
and it can therefore avoid performing any scans at all.
|
public final void | setCallback(android.support.v7.media.MediaRouteProvider$Callback callback)Sets a callback to invoke when the provider's descriptor changes.
MediaRouter.checkCallingThread();
mCallback = callback;
|
public final void | setDescriptor(MediaRouteProviderDescriptor descriptor)Sets the provider's descriptor.
The provider must call this method to notify the currently registered
{@link Callback callback} about the change to the provider's descriptor.
MediaRouter.checkCallingThread();
if (mDescriptor != descriptor) {
mDescriptor = descriptor;
if (!mPendingDescriptorChange) {
mPendingDescriptorChange = true;
mHandler.sendEmptyMessage(MSG_DELIVER_DESCRIPTOR_CHANGED);
}
}
|
public final void | setDiscoveryRequest(MediaRouteDiscoveryRequest request)Sets a discovery request to inform the provider about the kinds of
routes that its clients would like to discover and whether to perform active scanning.
MediaRouter.checkCallingThread();
if (mDiscoveryRequest == request
|| (mDiscoveryRequest != null && mDiscoveryRequest.equals(request))) {
return;
}
mDiscoveryRequest = request;
if (!mPendingDiscoveryRequestChange) {
mPendingDiscoveryRequestChange = true;
mHandler.sendEmptyMessage(MSG_DELIVER_DISCOVERY_REQUEST_CHANGED);
}
|