Lines Matching refs:route

57  * can query the media router about the currently selected route and its capabilities
58 * to determine how to send content to the route's destination. Applications can
59 * also {@link RouteInfo#sendControlRequest send control requests} to the route
60 * to ask the route's destination to perform certain remote control functions
76 * when the reason the route was unselected is unknown.
94 * when the user selected a different route.
125 * except when actively scanning. This flag is typically used when the route picker
126 * dialog has been opened by the user to ensure that the route information is
132 * discover and select a new route.
143 * Flag for {@link #addCallback}: Do not filter route events.
146 * route even if they do not match the callback's filter.
152 * Flag for {@link #addCallback}: Request passive route discovery while this
156 * Although route discovery is intended to be efficient, checking for new routes may
178 * Flag for {@link #addCallback}: Request passive route discovery while this
182 * since it may cause many media route providers to be started simultaneously.
193 * Flag for {@link #isRouteAvailable}: Ignore the default route.
195 * This flag is used to determine whether a matching non-default route is available.
196 * This constraint may be used to decide whether to offer the route chooser dialog
204 * Flag for {@link #isRouteAvailable}: Require an actual route to be matched.
207 * if it is possible to discover a matching route even if discovery is not in
208 * progress or if no matching route has yet been found. This feature is used to
209 * save resources by removing the need to perform passive route discovery on
213 * a matching route has actually been discovered.
232 * media router instance, all of its callbacks will be removed and route discovery
262 * Gets information about the {@link MediaRouter.ProviderInfo route providers}
271 * Gets the default route for playing media content on the system.
273 * The system always provides a default route.
276 * @return The default route, which is guaranteed to never be null.
285 * Gets the currently selected route.
287 * The application should examine the route's
289 * capabilities of the route before attempting to use it.
296 * MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute();
299 * if (route.supportsControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)) {
300 * // The route supports remote playback.
305 * if (route.supportsControlRequest(intent)) {
306 * route.sendControlRequest(intent, null);
312 * if (route.supportsControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO)) {
313 * // The route supports live video streaming.
318 * // Neither interface is supported, so we can't play the movie to this route.
323 * @return The selected route, which is guaranteed to never be null.
336 * Returns the selected route if it matches the specified selector, otherwise
337 * selects the default route and returns it.
340 * @return The previously selected route if it matched the selector, otherwise the
341 * newly selected default route which is guaranteed to never be null.
357 RouteInfo route = sGlobal.getSelectedRoute();
358 if (!route.isDefault() && !route.matchesSelector(selector)) {
359 route = sGlobal.getDefaultRoute();
360 sGlobal.selectRoute(route);
362 return route;
366 * Selects the specified route.
368 * @param route The route to select.
370 public void selectRoute(@NonNull RouteInfo route) {
371 if (route == null) {
372 throw new IllegalArgumentException("route must not be null");
377 Log.d(TAG, "selectRoute: " + route);
379 sGlobal.selectRoute(route);
383 * Unselects the current round and selects the default route instead.
393 * @param reason The reason for disconnecting the current route.
398 throw new IllegalArgumentException("Unsupported reason to unselect route");
406 * Returns true if there is a route that matches the specified selector.
415 * will return true if it is possible to discover a matching route even if
416 * discovery is not in progress or if no matching route has yet been found.
421 * @param flags Flags to control the determination of whether a route may be
425 * @return True if a matching route may be available.
444 * @param selector A route selector that indicates the kinds of routes that the
472 * whether is it possible to discover a route with the desired capabilities
473 * and therefore whether the media route button should be shown to the user.
484 * since it may cause many media route providers to be started simultaneously.
489 * media route chooser dialog is showing to confirm the presence of available
520 * MediaRouter.RouteInfo route = mediaRouter.updateSelectedRoute(mSelector);
521 * // do something with the route...
538 * @param selector A route selector that indicates the kinds of routes that the
620 * Registers a media route provider within this application process.
626 * @param providerInstance The media route provider instance to add.
644 * Unregisters a media route provider within this application process.
650 * @param providerInstance The media route provider instance to remove.
669 * of the selected route.
709 * selected route. This should be used instead of
725 * selected route. This should be used instead of
758 * Provides information about a media route.
760 * Each media route has a list of {@link MediaControlIntent media control}
762 * route and the manner in which it is used and controlled.
842 * Gets information about the provider of this media route.
849 * Gets the unique id of the route.
851 * The route unique id functions as a stable identifier by which the route is known.
853 * selected route across restarts or to communicate its identity to a service.
856 * @return The unique id of the route, never null.
864 * Gets the user-visible name of the route.
866 * The route name identifies the destination represented by the route.
870 * @return The user-visible name of a media route. This is the string presented
871 * to users who may select this as the active route.
878 * Gets the user-visible description of the route.
880 * The route description describes the kind of destination represented by the route.
884 * @return The description of the route, or null if none.
892 * Returns true if this route is enabled and may be selected.
894 * @return True if this route is enabled.
901 * Returns true if the route is in the process of connecting and is not
904 * @return True if this route is in the process of connecting.
911 * Returns true if this route is currently selected.
913 * @return True if this route is currently selected.
923 * Returns true if this route is the default route.
925 * @return True if this route is the default route.
936 * describe the capabilities of this route and the media control actions that
940 * this route supports.
951 * Returns true if the route supports at least one of the capabilities
952 * described by a media route selector.
955 * @return True if the route supports at least one of the capabilities
956 * described in the media route selector.
967 * Returns true if the route supports the specified
970 * Media control categories describe the capabilities of this route
979 * @return True if the route supports the specified intent category.
1000 * Returns true if the route supports the specified
1004 * can ask a route to perform.
1014 * @return True if the route supports the specified intent action.
1039 * Returns true if the route supports the specified
1042 * Media control requests are used to request the route to perform
1047 * @return True if the route can handle the specified intent.
1070 * asynchronously by the route's destination.
1072 * Media control requests are used to request the route to perform
1075 * This function may only be called on a selected route. Control requests
1096 * Gets the type of playback associated with this route.
1098 * @return The type of playback associated with this route: {@link #PLAYBACK_TYPE_LOCAL}
1107 * Gets the audio stream over which the playback associated with this route is performed.
1109 * @return The stream over which the playback associated with this route is performed.
1116 * Gets information about how volume is handled on the route.
1118 * @return How volume is handled on the route: {@link #PLAYBACK_VOLUME_FIXED}
1127 * Gets the current volume for this route. Depending on the route, this may only
1128 * be valid if the route is currently selected.
1130 * @return The volume at which the playback associated with this route is performed.
1137 * Gets the maximum volume at which the playback associated with this route is performed.
1140 * this route is performed.
1147 * Gets whether this route supports disconnecting without interrupting
1150 * @return True if this route can disconnect without stopping playback,
1158 * Requests a volume change for this route asynchronously.
1160 * This function may only be called on a selected route. It will have
1161 * no effect if the route is currently unselected.
1172 * Requests an incremental volume update for this route asynchronously.
1174 * This function may only be called on a selected route. It will have
1175 * no effect if the route is currently unselected.
1189 * a {@link android.app.Presentation} on an external display when this route is selected.
1190 * Depending on the route, this may only be valid if the route is currently
1193 * The preferred presentation display may change independently of the route
1195 * of the default system route may change when an external HDMI display is connected
1196 * or disconnected even though the route itself has not changed.
1199 * the route or if the display is not ready to show UI yet.
1210 * @return The preferred presentation display to use when this route is
1226 * Gets a collection of extra properties about this route that were supplied
1227 * by its media route provider, or null if none.
1236 * route.
1244 * Selects this media route.
1349 * Provides information about a media route provider.
1351 * This object may be used to determine which media route provider has
1352 * published a particular route.
1378 * Gets the package name of the media route provider.
1385 * Gets the component name of the media route provider.
1392 * Gets the {@link MediaRouter.RouteInfo routes} published by this route provider.
1406 Log.w(TAG, "Unable to obtain resources for route provider package: "
1453 * Called when the supplied media route becomes selected as the active route.
1456 * @param route The route that has been selected.
1458 public void onRouteSelected(MediaRouter router, RouteInfo route) {
1462 * Called when the supplied media route becomes unselected as the active route.
1465 * @param route The route that has been unselected.
1467 public void onRouteUnselected(MediaRouter router, RouteInfo route) {
1471 * Called when a media route has been added.
1474 * @param route The route that has become available for use.
1476 public void onRouteAdded(MediaRouter router, RouteInfo route) {
1480 * Called when a media route has been removed.
1483 * @param route The route that has been removed from availability.
1485 public void onRouteRemoved(MediaRouter router, RouteInfo route) {
1489 * Called when a property of the indicated media route has changed.
1492 * @param route The route that was changed.
1494 public void onRouteChanged(MediaRouter router, RouteInfo route) {
1498 * Called when a media route's volume changes.
1501 * @param route The route whose volume changed.
1503 public void onRouteVolumeChanged(MediaRouter router, RouteInfo route) {
1507 * Called when a media route's presentation display changes.
1509 * This method is called whenever the route's presentation display becomes
1514 * @param route The route whose presentation display changed.
1518 public void onRoutePresentationDisplayChanged(MediaRouter router, RouteInfo route) {
1522 * Called when a media route provider has been added.
1531 * Called when a media route provider has been removed.
1540 * Called when a property of the indicated media route provider has changed.
1588 public boolean filterRouteEvent(RouteInfo route) {
1590 || route.matchesSelector(mSelector);
1597 * Media routes and media route providers are global to the process; their
1649 // Add the system media route provider for interoperating with
1657 // Start watching for routes published by registered media route
1699 public void sendControlRequest(RouteInfo route,
1701 if (route == mSelectedRoute && mSelectedRouteController != null) {
1711 public void requestSetVolume(RouteInfo route, int volume) {
1712 if (route == mSelectedRoute && mSelectedRouteController != null) {
1717 public void requestUpdateVolume(RouteInfo route, int delta) {
1718 if (route == mSelectedRoute && mSelectedRouteController != null) {
1736 throw new IllegalStateException("There is no default route. "
1747 throw new IllegalStateException("There is no currently selected route. "
1753 public void selectRoute(RouteInfo route) {
1754 selectRoute(route, MediaRouter.UNSELECT_REASON_ROUTE_CHANGED);
1757 public void selectRoute(RouteInfo route, int unselectReason) {
1758 if (!mRoutes.contains(route)) {
1759 Log.w(TAG, "Ignoring attempt to select removed route: " + route);
1762 if (!route.mEnabled) {
1763 Log.w(TAG, "Ignoring attempt to select disabled route: " + route);
1767 setSelectedRouteInternal(route, unselectReason);
1783 RouteInfo route = mRoutes.get(i);
1785 && route.isDefault()) {
1788 if (route.matchesSelector(selector)) {
1793 // It doesn't look like we can find a matching route right now.
1848 Log.i(TAG, "Forcing passive route discovery on a low-RAM device, "
1938 // 1. Add the route to the list.
1940 RouteInfo route = new RouteInfo(provider, id, uniqueId);
1941 provider.mRoutes.add(targetIndex++, route);
1942 mRoutes.add(route);
1943 // 2. Create the route's contents.
1944 route.updateDescriptor(routeDescriptor);
1947 Log.d(TAG, "Route added: " + route);
1949 mCallbackHandler.post(CallbackHandler.MSG_ROUTE_ADDED, route);
1951 Log.w(TAG, "Ignoring route descriptor with duplicate id: "
1954 // 1. Reorder the route within the list.
1955 RouteInfo route = provider.mRoutes.get(sourceIndex);
1958 // 2. Update the route's contents.
1959 int changes = route.updateDescriptor(routeDescriptor);
1964 Log.d(TAG, "Route changed: " + route);
1967 CallbackHandler.MSG_ROUTE_CHANGED, route);
1971 Log.d(TAG, "Route volume changed: " + route);
1974 CallbackHandler.MSG_ROUTE_VOLUME_CHANGED, route);
1979 + route);
1982 MSG_ROUTE_PRESENTATION_DISPLAY_CHANGED, route);
1984 if (route == mSelectedRoute) {
1997 // 1. Delete the route's contents.
1998 RouteInfo route = provider.mRoutes.get(i);
1999 route.updateDescriptor(null);
2000 // 2. Remove the route from the list.
2001 mRoutes.remove(route);
2004 // Update the selected route if needed.
2008 // We do this after updating the selected route to ensure
2009 // that the framework media router observes the new route
2011 // selected route may have side-effects.
2013 RouteInfo route = provider.mRoutes.remove(i);
2015 Log.d(TAG, "Route removed: " + route);
2017 mCallbackHandler.post(CallbackHandler.MSG_ROUTE_REMOVED, route);
2029 // Although route descriptor ids are unique within a provider, it's
2056 // Update default route.
2058 Log.i(TAG, "Clearing the default route because it "
2063 for (RouteInfo route : mRoutes) {
2064 if (isSystemDefaultRoute(route) && isRouteSelectable(route)) {
2065 mDefaultRoute = route;
2066 Log.i(TAG, "Found default route: " + mDefaultRoute);
2072 // Update selected route.
2074 Log.i(TAG, "Unselecting the current route because it "
2080 // Choose a new route.
2082 // the new route is selected.
2086 // Update the playback info because the properties of the route have changed.
2092 // When the current route is removed or no longer selectable,
2093 // we want to revert to a live audio route if there is
2095 // the default route.
2096 for (RouteInfo route : mRoutes) {
2097 if (route != mDefaultRoute
2098 && isSystemLiveAudioOnlyRoute(route)
2099 && isRouteSelectable(route)) {
2100 return route;
2106 private boolean isSystemLiveAudioOnlyRoute(RouteInfo route) {
2107 return route.getProviderInstance() == mSystemProvider
2108 && route.supportsControlCategory(MediaControlIntent.CATEGORY_LIVE_AUDIO)
2109 && !route.supportsControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO);
2112 private boolean isRouteSelectable(RouteInfo route) {
2113 // This tests whether the route is still valid and enabled.
2114 // The route descriptor field is set to null when the route is removed.
2115 return route.mDescriptor != null && route.mEnabled;
2118 private boolean isSystemDefaultRoute(RouteInfo route) {
2119 return route.getProviderInstance() == mSystemProvider
2120 && route.mDescriptorId.equals(
2124 private void setSelectedRouteInternal(RouteInfo route, int unselectReason) {
2125 if (mSelectedRoute != route) {
2139 mSelectedRoute = route;
2142 mSelectedRouteController = route.getProviderInstance().onCreateRouteController(
2143 route.mDescriptorId);
2252 // Local route
2454 final RouteInfo route = (RouteInfo)obj;
2455 if (!record.filterRouteEvent(route)) {
2460 callback.onRouteAdded(router, route);
2463 callback.onRouteRemoved(router, route);
2466 callback.onRouteChanged(router, route);
2469 callback.onRouteVolumeChanged(router, route);
2472 callback.onRoutePresentationDisplayChanged(router, route);
2475 callback.onRouteSelected(router, route);
2478 callback.onRouteUnselected(router, route);