summaryrefslogtreecommitdiffstats
path: root/core/java/android/app
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2013-11-07 00:30:16 -0800
committerJeff Brown <jeffbrown@google.com>2013-11-07 03:25:37 -0800
commit69b07161bebdb2c726e3a826c2268866f1a94517 (patch)
tree8d9c94f32a045a8f5c48ca0f1380abc760eac807 /core/java/android/app
parentf3c99e883f46c56e5e2877e844b902b6eb45545b (diff)
downloadframeworks_base-69b07161bebdb2c726e3a826c2268866f1a94517.zip
frameworks_base-69b07161bebdb2c726e3a826c2268866f1a94517.tar.gz
frameworks_base-69b07161bebdb2c726e3a826c2268866f1a94517.tar.bz2
Add media router service and integrate with remote displays.
This change adds a new media router service whose purpose is to track global state information associated with media routes. This service publishes routes to the media router instance in application processes and handles requested state changes such as selecting or unselecting global routes. The service also binds to remote display provider services which can offer new remote display routes to the system. Includes a test application for manually verifying certain aspects of the operation of the media router service. The remote display provider interface is essentially a stripped down media route provider interface as defined in the support library media router implementation. For now, it is designed to be used only by first parties to publish remote display routes to the system so it is not exposed as public API in the SDK. In the future, the remote display provider interface will most likely be deprecated and replaced with a more featureful media route provider interface for third party integration, similar to what is in the support library today. Further patch sets integrate these new capabilities into the System UI and Settings for connecting remote displays. Bug: 11257292 Change-Id: I31109f23f17b474d17534d0f5f4503e388b081c2
Diffstat (limited to 'core/java/android/app')
-rw-r--r--core/java/android/app/MediaRouteActionProvider.java2
-rw-r--r--core/java/android/app/MediaRouteButton.java27
2 files changed, 16 insertions, 13 deletions
diff --git a/core/java/android/app/MediaRouteActionProvider.java b/core/java/android/app/MediaRouteActionProvider.java
index 63b641c..6839c8e 100644
--- a/core/java/android/app/MediaRouteActionProvider.java
+++ b/core/java/android/app/MediaRouteActionProvider.java
@@ -60,7 +60,7 @@ public class MediaRouteActionProvider extends ActionProvider {
}
mRouteTypes = types;
if (types != 0) {
- mRouter.addCallback(types, mCallback);
+ mRouter.addCallback(types, mCallback, MediaRouter.CALLBACK_FLAG_PASSIVE_DISCOVERY);
}
if (mView != null) {
mView.setRouteTypes(mRouteTypes);
diff --git a/core/java/android/app/MediaRouteButton.java b/core/java/android/app/MediaRouteButton.java
index 7e0a27a..9b1ff93 100644
--- a/core/java/android/app/MediaRouteButton.java
+++ b/core/java/android/app/MediaRouteButton.java
@@ -123,14 +123,14 @@ public class MediaRouteButton extends View {
if (mToggleMode) {
if (mRemoteActive) {
- mRouter.selectRouteInt(mRouteTypes, mRouter.getDefaultRoute());
+ mRouter.selectRouteInt(mRouteTypes, mRouter.getDefaultRoute(), true);
} 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.getDefaultRoute()) {
- mRouter.selectRouteInt(mRouteTypes, route);
+ mRouter.selectRouteInt(mRouteTypes, route, true);
}
}
}
@@ -201,7 +201,8 @@ public class MediaRouteButton extends View {
if (mAttachedToWindow) {
updateRouteInfo();
- mRouter.addCallback(types, mRouterCallback);
+ mRouter.addCallback(types, mRouterCallback,
+ MediaRouter.CALLBACK_FLAG_PASSIVE_DISCOVERY);
}
}
@@ -217,8 +218,7 @@ public class MediaRouteButton extends View {
void updateRemoteIndicator() {
final RouteInfo selected = mRouter.getSelectedRoute(mRouteTypes);
final boolean isRemote = selected != mRouter.getDefaultRoute();
- final boolean isConnecting = selected != null &&
- selected.getStatusCode() == RouteInfo.STATUS_CONNECTING;
+ final boolean isConnecting = selected != null && selected.isConnecting();
boolean needsRefresh = false;
if (mRemoteActive != isRemote) {
@@ -238,7 +238,7 @@ public class MediaRouteButton extends View {
void updateRouteCount() {
final int N = mRouter.getRouteCount();
int count = 0;
- boolean hasVideoRoutes = false;
+ boolean scanRequired = false;
for (int i = 0; i < N; i++) {
final RouteInfo route = mRouter.getRouteAt(i);
final int routeTypes = route.getSupportedTypes();
@@ -248,8 +248,9 @@ public class MediaRouteButton extends View {
} else {
count++;
}
- if ((routeTypes & MediaRouter.ROUTE_TYPE_LIVE_VIDEO) != 0) {
- hasVideoRoutes = true;
+ if (((routeTypes & MediaRouter.ROUTE_TYPE_LIVE_VIDEO
+ | MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY)) != 0) {
+ scanRequired = true;
}
}
}
@@ -257,9 +258,10 @@ public class MediaRouteButton extends View {
setEnabled(count != 0);
// Only allow toggling if we have more than just user routes.
- // Don't toggle if we support video routes, we may have to let the dialog scan.
- mToggleMode = count == 2 && (mRouteTypes & MediaRouter.ROUTE_TYPE_LIVE_AUDIO) != 0 &&
- !hasVideoRoutes;
+ // Don't toggle if we support video or remote display routes, we may have to
+ // let the dialog scan.
+ mToggleMode = count == 2 && (mRouteTypes & MediaRouter.ROUTE_TYPE_LIVE_AUDIO) != 0
+ && !scanRequired;
}
@Override
@@ -313,7 +315,8 @@ public class MediaRouteButton extends View {
super.onAttachedToWindow();
mAttachedToWindow = true;
if (mRouteTypes != 0) {
- mRouter.addCallback(mRouteTypes, mRouterCallback);
+ mRouter.addCallback(mRouteTypes, mRouterCallback,
+ MediaRouter.CALLBACK_FLAG_PASSIVE_DISCOVERY);
updateRouteInfo();
}
}