Lines Matching refs:route

143             // This will select the active wifi display route if there is one.
159 // This will select the active BT route if there is one and the current
160 // selected route is the default system route, or if there is no selected
161 // route yet.
168 // Select the default route if the above didn't sync us up
326 final RouteInfo route = mRoutes.get(i);
327 if (route.updatePresentationDisplay() || (route.mPresentationDisplay != null
328 && route.mPresentationDisplay.getDisplayId() == changedDisplayId)) {
329 dispatchRoutePresentationDisplayChanged(route);
386 Log.e(TAG, "Unable to publish media router client selected route.", ex);
410 RouteInfo route = findGlobalRoute(globalRoute.id);
411 if (route == null) {
412 route = makeGlobalRoute(globalRoute);
413 addRouteStatic(route);
415 updateGlobalRoute(route, globalRoute);
419 // Synchronize state with the globally selected route.
421 final RouteInfo route = findGlobalRoute(globallySelectedRouteId);
422 if (route == null) {
423 Log.w(TAG, "Could not find new globally selected route: "
425 } else if (route != mSelectedRoute) {
427 Log.d(TAG, "Selecting new globally selected route: " + route);
429 selectRouteStatic(route.mSupportedTypes, route, false);
433 Log.d(TAG, "Unselecting previous globally selected route: " + mSelectedRoute);
440 final RouteInfo route = mRoutes.get(i);
441 final String globalRouteId = route.mGlobalRouteId;
450 removeRouteStatic(route);
455 void requestSetVolume(RouteInfo route, int volume) {
456 if (route.mGlobalRouteId != null && mClient != null) {
459 route.mGlobalRouteId, volume);
466 void requestUpdateVolume(RouteInfo route, int direction) {
467 if (route.mGlobalRouteId != null && mClient != null) {
470 route.mGlobalRouteId, direction);
478 RouteInfo route = new RouteInfo(sStatic.mSystemCategory);
479 route.mGlobalRouteId = globalRoute.id;
480 route.mName = globalRoute.name;
481 route.mDescription = globalRoute.description;
482 route.mSupportedTypes = globalRoute.supportedTypes;
483 route.mEnabled = globalRoute.enabled;
484 route.setRealStatusCode(globalRoute.statusCode);
485 route.mPlaybackType = globalRoute.playbackType;
486 route.mPlaybackStream = globalRoute.playbackStream;
487 route.mVolume = globalRoute.volume;
488 route.mVolumeMax = globalRoute.volumeMax;
489 route.mVolumeHandling = globalRoute.volumeHandling;
490 route.mPresentationDisplayId = globalRoute.presentationDisplayId;
491 route.updatePresentationDisplay();
492 return route;
495 void updateGlobalRoute(RouteInfo route, MediaRouterClientState.RouteInfo globalRoute) {
500 if (!Objects.equals(route.mName, globalRoute.name)) {
501 route.mName = globalRoute.name;
504 if (!Objects.equals(route.mDescription, globalRoute.description)) {
505 route.mDescription = globalRoute.description;
508 final int oldSupportedTypes = route.mSupportedTypes;
510 route.mSupportedTypes = globalRoute.supportedTypes;
513 if (route.mEnabled != globalRoute.enabled) {
514 route.mEnabled = globalRoute.enabled;
517 if (route.mRealStatusCode != globalRoute.statusCode) {
518 route.setRealStatusCode(globalRoute.statusCode);
521 if (route.mPlaybackType != globalRoute.playbackType) {
522 route.mPlaybackType = globalRoute.playbackType;
525 if (route.mPlaybackStream != globalRoute.playbackStream) {
526 route.mPlaybackStream = globalRoute.playbackStream;
529 if (route.mVolume != globalRoute.volume) {
530 route.mVolume = globalRoute.volume;
534 if (route.mVolumeMax != globalRoute.volumeMax) {
535 route.mVolumeMax = globalRoute.volumeMax;
539 if (route.mVolumeHandling != globalRoute.volumeHandling) {
540 route.mVolumeHandling = globalRoute.volumeHandling;
544 if (route.mPresentationDisplayId != globalRoute.presentationDisplayId) {
545 route.mPresentationDisplayId = globalRoute.presentationDisplayId;
546 route.updatePresentationDisplay();
552 dispatchRouteChanged(route, oldSupportedTypes);
555 dispatchRouteVolumeChanged(route);
558 dispatchRoutePresentationDisplayChanged(route);
565 final RouteInfo route = mRoutes.get(i);
566 if (globalRouteId.equals(route.mGlobalRouteId)) {
567 return route;
628 * <p>Unlike other media route types, user routes are managed by the application.
644 * except when actively scanning. This flag is typically used when the route picker
645 * dialog has been opened by the user to ensure that the route information is
651 * discover and select a new route.
657 * Flag for {@link #addCallback}: Do not filter route events.
660 * route even if they do not match the callback's filter.
682 * Flag for {@link #isRouteAvailable}: Ignore the default route.
684 * This flag is used to determine whether a matching non-default route is available.
685 * This constraint may be used to decide whether to offer the route chooser dialog
726 * Gets the default route for playing media content on the system.
728 * The system always provides a default route.
731 * @return The default route, which is guaranteed to never be null.
750 * Return the currently selected route for any of the given types
752 * @param type route types
753 * @return the selected route
758 // If the selected route supports any of the types supplied, it's still considered
762 // The caller specifically asked for a user route and the currently selected route
766 // If the above didn't match and we're not specifically asking for a user route,
772 * Returns true if there is a route that matches the specified types.
781 * @param flags Flags to control the determination of whether a route may be available.
783 * @return True if a matching route may be available.
790 RouteInfo route = sStatic.mRoutes.get(i);
791 if (route.matchesTypes(types)) {
793 || route != sStatic.mDefaultAudioVideo) {
799 // It doesn't look like we can find a matching route right now.
806 * additional route types specified.
822 * additional route types specified.
876 * Select the specified route to use for output of the given media types.
878 * As API version 18, this function may be used to select any route.
880 * routes and would ignore any attempt to select a system route.
883 * @param types type flags indicating which types this route should be used for.
884 * The route must support at least a subset.
885 * @param route Route to select
886 * @throws IllegalArgumentException if the given route is {@code null}
888 public void selectRoute(int types, @NonNull RouteInfo route) {
889 if (route == null) {
892 selectRouteStatic(types, route, true);
898 public void selectRouteInt(int types, RouteInfo route, boolean explicit) {
899 selectRouteStatic(types, route, explicit);
902 static void selectRouteStatic(int types, @NonNull RouteInfo route, boolean explicit) {
903 assert(route != null);
905 if (oldRoute == route) return;
906 if (!route.matchesTypes(types)) {
907 Log.w(TAG, "selectRoute ignored; cannot select route with supported types " +
908 typesToString(route.getSupportedTypes()) + " into route types " +
915 (route == btRoute || route == sStatic.mDefaultAudioVideo)) {
917 sStatic.mAudioService.setBluetoothA2dpOn(route == btRoute);
926 final boolean newRouteHasAddress = route.mDeviceAddress != null;
928 if (newRouteHasAddress && !matchesDeviceAddress(activeDisplay, route)) {
930 sStatic.mDisplayService.connectWifiDisplay(route.mDeviceAddress);
940 sStatic.setSelectedRoute(route, explicit);
948 if (route != null) {
949 if (route.resolveStatusCode()) {
950 dispatchRouteChanged(route);
952 dispatchRouteSelected(types & route.getSupportedTypes(), route);
955 // The behavior of active scans may depend on the currently selected route.
960 // TODO: Be smarter about the route types here; this selects for all valid.
970 * Compare the device address of a display and a route.
986 * Add an app-specified route for media to the MediaRouter.
987 * App-specified route definitions are created using {@link #createUserRoute(RouteCategory)}
989 * @param info Definition of the route to add
1010 // Enforce that any added route in a groupable category must be in a group.
1025 * Remove an app-specified route for media from the MediaRouter.
1027 * @param info Definition of the route to remove
1071 // Removing the currently selected route? Select the default before we remove it.
1113 * Return the route at the specified index.
1115 * @param index index of the route to return
1116 * @return the route at index
1131 * Create a new user route that may be modified and registered for use by the application.
1133 * @param category The category the new route will belong to
1145 * Create a new route category. Each route must belong to a category.
1156 * Create a new route category. Each route must belong to a category.
1212 // FIXME: This is a strong signal that we should deprecate route type filtering
1331 RouteInfo route = findWifiDisplayRoute(d);
1332 if (route == null) {
1333 route = makeWifiDisplayRoute(d, status);
1334 addRouteStatic(route);
1339 updateWifiDisplayRoute(route, d, status, disconnected);
1342 selectRouteStatic(route.getSupportedTypes(), route, false);
1349 RouteInfo route = sStatic.mRoutes.get(i);
1350 if (route.mDeviceAddress != null) {
1351 WifiDisplay d = findWifiDisplay(displays, route.mDeviceAddress);
1353 removeRouteStatic(route);
1418 RouteInfo route, WifiDisplay display, WifiDisplayStatus wfdStatus,
1422 if (!route.getName().equals(newName)) {
1423 route.mName = newName;
1428 changed |= route.mEnabled != enabled;
1429 route.mEnabled = enabled;
1431 changed |= route.setRealStatusCode(getWifiDisplayStatusCode(display, wfdStatus));
1434 dispatchRouteChanged(route);
1437 if ((!enabled || disconnected) && route.isSelected()) {
1465 * Information about a media route.
1489 // An id by which the route is known to the media router service.
1490 // Null if this route only exists as an artifact within this process.
1539 * Gets the user-visible name of the route.
1541 * The route name identifies the destination represented by the route.
1545 * @return The user-visible name of a media route. This is the string presented
1546 * to users who may select this as the active route.
1553 * Return the properly localized/resource user-visible name of this route.
1555 * The route name identifies the destination represented by the route.
1560 * @return The user-visible name of a media route. This is the string presented
1561 * to users who may select this as the active route.
1575 * Gets the user-visible description of the route.
1577 * The route description describes the kind of destination represented by the route.
1581 * @return The description of the route, or null if none.
1588 * @return The user-visible status for a media route. This may include a description
1596 * Set this route's status by predetermined status code. If the caller
1597 * should dispatch a route changed event this call will return true;
1615 // If the route is selected and its status appears to be between states
1667 * @return A media type flag set describing which types this route supports.
1679 * @return The group that this route belongs to.
1686 * @return the category this route belongs to.
1693 * Get the icon representing this route.
1696 * @return the icon representing this route or null if no icon is available
1703 * Set an application-specific tag object for this route.
1705 * route for internal tracking.
1707 * <p>Note that the lifespan of a route may be well past the lifespan of
1711 * @param tag Arbitrary, app-specific data for this route to hold for later use
1727 * @return the type of playback associated with this route
1735 * @return the stream over which the playback associated with this route is performed
1743 * Return the current volume for this route. Depending on the route, this may only
1744 * be valid if the route is currently selected.
1746 * @return the volume at which the playback associated with this route is performed
1764 * Request a volume change for this route.
1781 * Request an incremental volume update for this route.
1800 * @return the maximum volume at which the playback associated with this route is performed
1818 * @return how volume is handling on the route
1827 * a {@link android.app.Presentation} on an external display when this route is selected.
1828 * Depending on the route, this may only be valid if the route is currently
1831 * The preferred presentation display may change independently of the route
1833 * of the default system route may change when an external HDMI display is connected
1834 * or disconnected even though the route itself has not changed.
1837 * the route or if the display is not ready to show UI yet.
1847 * @return The preferred presentation display to use when this route is
1893 // For the default route, choose the first presentation display from the list.
1907 * Returns true if this route is enabled and may be selected.
1909 * @return True if this route is enabled.
1916 * Returns true if the route is in the process of connecting and is not
1919 * @return True if this route is in the process of connecting.
1958 mVcb.vcb.onVolumeUpdateRequest(mVcb.route, direction);
1960 mVcb.vcb.onVolumeSetRequest(mVcb.route, value);
1985 * Information about a route that the application may define and modify.
1986 * A user route defaults to {@link RouteInfo#PLAYBACK_TYPE_REMOTE} and
2003 * Set the user-visible name of this route.
2004 * @param name Name to display to the user to describe this route
2012 * Set the user-visible name of this route.
2014 * The route name identifies the destination represented by the route.
2018 * @param resId Resource ID of the name to display to the user to describe this route
2027 * Set the user-visible description of this route.
2029 * The route description describes the kind of destination represented by the route.
2033 * @param description The description of the route, or null if none.
2041 * Set the current user-visible status for this route.
2043 * of this route is currently doing
2051 * user route.
2053 * <p>If this route manages remote playback, the data exposed by this
2055 * such as route volume info in related UIs.</p>
2060 * @param rcc RemoteControlClient associated with this route
2068 * Retrieve the RemoteControlClient associated with this route, if one has been set.
2070 * @return the RemoteControlClient associated with this route
2078 * Set an icon that will be used to represent this route.
2081 * @param icon icon drawable to use to represent this route
2088 * Set an icon that will be used to represent this route.
2091 * @param resId Resource ID of an icon drawable to use to represent this route
2106 * Defines whether playback associated with this route is "local"
2119 * Defines whether volume for the playback associated with this route is fixed
2132 * Defines at what volume the playback associated with this route is performed (for user
2154 Log.e(TAG, "Cannot requestSetVolume on user route - no volume callback set");
2165 Log.e(TAG, "Cannot requestChangeVolume on user route - no volumec callback set");
2173 * Defines the maximum volume at which the playback associated with this route is performed
2203 Log.d(TAG, "No Rcc to configure volume for route " + mName);
2251 mVcb.vcb.onVolumeSetRequest(mVcb.route, volume);
2263 mVcb.vcb.onVolumeUpdateRequest(mVcb.route, direction);
2272 * Information about a route that consists of multiple other routes in a group.
2291 * Add a route to this group. The route must not currently belong to another group.
2293 * @param route route to add to this group
2295 public void addRoute(RouteInfo route) {
2296 if (route.getGroup() != null) {
2297 throw new IllegalStateException("Route " + route + " is already part of a group.");
2299 if (route.getCategory() != mCategory) {
2302 "(Route category=" + route.getCategory() +
2306 mRoutes.add(route);
2307 route.mGroup = this;
2311 dispatchRouteGrouped(route, this, at);
2315 * Add a route to this group before the specified index.
2317 * @param route route to add
2318 * @param insertAt insert the new route before this index
2320 public void addRoute(RouteInfo route, int insertAt) {
2321 if (route.getGroup() != null) {
2322 throw new IllegalStateException("Route " + route + " is already part of a group.");
2324 if (route.getCategory() != mCategory) {
2327 "(Route category=" + route.getCategory() +
2330 mRoutes.add(insertAt, route);
2331 route.mGroup = this;
2335 dispatchRouteGrouped(route, this, insertAt);
2339 * Remove a route from this group.
2341 * @param route route to remove
2343 public void removeRoute(RouteInfo route) {
2344 if (route.getGroup() != this) {
2345 throw new IllegalArgumentException("Route " + route +
2348 mRoutes.remove(route);
2349 route.mGroup = null;
2352 dispatchRouteUngrouped(route, this);
2357 * Remove the route at the specified index from this group.
2359 * @param index index of the route to remove
2362 RouteInfo route = mRoutes.remove(index);
2363 route.mGroup = null;
2366 dispatchRouteUngrouped(route, this);
2378 * Return the route in this group at the specified index
2381 * @return The route at index
2417 final RouteInfo route = getRouteAt(i);
2418 final int routeVol = (int) (scaledVolume * route.getVolumeMax());
2419 route.requestSetVolume(routeVol);
2437 final RouteInfo route = getRouteAt(i);
2438 route.requestUpdateVolume(direction);
2439 final int routeVol = route.getVolume();
2493 final RouteInfo route = mRoutes.get(i);
2494 types |= route.mSupportedTypes;
2495 final int routeMaxVolume = route.getVolumeMax();
2499 isLocal &= route.getPlaybackType() == PLAYBACK_TYPE_LOCAL;
2500 isFixedVolume &= route.getVolumeHandling() == PLAYBACK_VOLUME_FIXED;
2560 * @return the name of this route category
2570 * @return the name of this route category
2588 * A RouteGroup is treated as a single route within its category.</p>
2605 final RouteInfo route = getRouteAtStatic(i);
2606 if (route.mCategory == this) {
2607 out.add(route);
2614 * @return Flag set describing the route types supported by this category
2660 public boolean filterRouteEvent(RouteInfo route) {
2661 return filterRouteEvent(route.mSupportedTypes);
2684 * Called when the supplied route becomes selected as the active route
2685 * for the given route type.
2689 * @param info Route that has been selected for the given route types
2694 * Called when the supplied route becomes unselected as the active route
2695 * for the given route type.
2699 * @param info Route that has been unselected for the given route types
2704 * Called when a route for the specified type was added.
2712 * Called when a route for the specified type was removed.
2720 * Called when an aspect of the indicated route has changed.
2722 * <p>This will not indicate that the types supported by this route have
2726 * @param info The route that was changed
2731 * Called when a route is added to a group.
2734 * @param info The route that was added
2735 * @param group The group the route was added to
2736 * @param index The route index within group that info was added at
2742 * Called when a route is removed from a group.
2745 * @param info The route that was removed
2746 * @param group The group the route was removed from
2751 * Called when a route's volume changes.
2754 * @param info The route with altered volume
2759 * Called when a route's presentation display changes.
2761 * This method is called whenever the route's presentation display becomes
2766 * @param info The route whose presentation display changed
2817 public final RouteInfo route;
2819 public VolumeCallbackInfo(VolumeCallback vcb, RouteInfo route) {
2821 this.route = route;
2836 * Called when the volume for the route should be increased or decreased.
2837 * @param info the route affected by this event
2845 * Called when the volume for the route should be set to the given value
2846 * @param info the route affected by this event