am 3afc18af: Enhance MediaRouter API.
* commit '3afc18af2cea898753b10e8575dcf20c11356bca': Enhance MediaRouter API.
This commit is contained in:
@@ -11792,6 +11792,7 @@ package android.media {
|
||||
method public android.media.MediaRouter.UserRouteInfo createUserRoute(android.media.MediaRouter.RouteCategory);
|
||||
method public android.media.MediaRouter.RouteCategory getCategoryAt(int);
|
||||
method public int getCategoryCount();
|
||||
method public android.media.MediaRouter.RouteInfo getDefaultRoute();
|
||||
method public android.media.MediaRouter.RouteInfo getRouteAt(int);
|
||||
method public int getRouteCount();
|
||||
method public android.media.MediaRouter.RouteInfo getSelectedRoute(int);
|
||||
|
||||
@@ -123,13 +123,13 @@ public class MediaRouteButton extends View {
|
||||
|
||||
if (mToggleMode) {
|
||||
if (mRemoteActive) {
|
||||
mRouter.selectRouteInt(mRouteTypes, mRouter.getSystemAudioRoute());
|
||||
mRouter.selectRouteInt(mRouteTypes, mRouter.getDefaultRoute());
|
||||
} else {
|
||||
final int N = mRouter.getRouteCount();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final RouteInfo route = mRouter.getRouteAt(i);
|
||||
if ((route.getSupportedTypes() & mRouteTypes) != 0 &&
|
||||
route != mRouter.getSystemAudioRoute()) {
|
||||
route != mRouter.getDefaultRoute()) {
|
||||
mRouter.selectRouteInt(mRouteTypes, route);
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ public class MediaRouteButton extends View {
|
||||
|
||||
void updateRemoteIndicator() {
|
||||
final RouteInfo selected = mRouter.getSelectedRoute(mRouteTypes);
|
||||
final boolean isRemote = selected != mRouter.getSystemAudioRoute();
|
||||
final boolean isRemote = selected != mRouter.getDefaultRoute();
|
||||
final boolean isConnecting = selected != null &&
|
||||
selected.getStatusCode() == RouteInfo.STATUS_CONNECTING;
|
||||
|
||||
|
||||
@@ -299,16 +299,21 @@ public class MediaRouter {
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide for use by framework routing UI
|
||||
* Gets the default route for playing media content on the system.
|
||||
* <p>
|
||||
* The system always provides a default route.
|
||||
* </p>
|
||||
*
|
||||
* @return The default route, which is guaranteed to never be null.
|
||||
*/
|
||||
public RouteInfo getSystemAudioRoute() {
|
||||
public RouteInfo getDefaultRoute() {
|
||||
return sStatic.mDefaultAudioVideo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide for use by framework routing UI
|
||||
*/
|
||||
public RouteCategory getSystemAudioCategory() {
|
||||
public RouteCategory getSystemCategory() {
|
||||
return sStatic.mSystemCategory;
|
||||
}
|
||||
|
||||
@@ -372,14 +377,17 @@ public class MediaRouter {
|
||||
|
||||
/**
|
||||
* Select the specified route to use for output of the given media types.
|
||||
* <p class="note">
|
||||
* As API version 18, this function may be used to select any route.
|
||||
* In prior versions, this function could only be used to select user
|
||||
* routes and would ignore any attempt to select a system route.
|
||||
* </p>
|
||||
*
|
||||
* @param types type flags indicating which types this route should be used for.
|
||||
* The route must support at least a subset.
|
||||
* @param route Route to select
|
||||
*/
|
||||
public void selectRoute(int types, RouteInfo route) {
|
||||
// Applications shouldn't programmatically change anything but user routes.
|
||||
types &= ROUTE_TYPE_USER;
|
||||
selectRouteStatic(types, route);
|
||||
}
|
||||
|
||||
@@ -454,7 +462,7 @@ public class MediaRouter {
|
||||
* App-specified route definitions are created using {@link #createUserRoute(RouteCategory)}
|
||||
*
|
||||
* @param info Definition of the route to add
|
||||
* @see #createUserRoute()
|
||||
* @see #createUserRoute(RouteCategory)
|
||||
* @see #removeUserRoute(UserRouteInfo)
|
||||
*/
|
||||
public void addUserRoute(UserRouteInfo info) {
|
||||
|
||||
Reference in New Issue
Block a user