summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2013-11-07 17:47:25 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-11-07 17:47:25 -0800
commit7da5bbedc75d7143d5b2cf36c4876f7b09a88807 (patch)
treeee4e576c15a787bffc1bc83149c754fc17950b20 /core
parent6c58d890f3a6993a3bcf413b84ba6fba875832f8 (diff)
parentc2b652fd4d386b79dc99af249b6ad3844e53fdf1 (diff)
downloadframeworks_base-7da5bbedc75d7143d5b2cf36c4876f7b09a88807.zip
frameworks_base-7da5bbedc75d7143d5b2cf36c4876f7b09a88807.tar.gz
frameworks_base-7da5bbedc75d7143d5b2cf36c4876f7b09a88807.tar.bz2
am c2b652fd: am 5182ea4b: am d40a4d74: Merge "Add media router service and integrate with remote displays." into klp-dev
* commit 'c2b652fd4d386b79dc99af249b6ad3844e53fdf1': Add media router service and integrate with remote displays.
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/MediaRouteActionProvider.java2
-rw-r--r--core/java/android/app/MediaRouteButton.java27
-rw-r--r--core/java/android/view/Display.java9
-rw-r--r--core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java6
4 files changed, 28 insertions, 16 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 2464e35..e75dc29 100644
--- a/core/java/android/app/MediaRouteButton.java
+++ b/core/java/android/app/MediaRouteButton.java
@@ -128,14 +128,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);
}
}
}
@@ -206,7 +206,8 @@ public class MediaRouteButton extends View {
if (mAttachedToWindow) {
updateRouteInfo();
- mRouter.addCallback(types, mRouterCallback);
+ mRouter.addCallback(types, mRouterCallback,
+ MediaRouter.CALLBACK_FLAG_PASSIVE_DISCOVERY);
}
}
@@ -222,8 +223,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) {
@@ -243,7 +243,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();
@@ -253,8 +253,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;
}
}
}
@@ -262,9 +263,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
@@ -318,7 +320,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();
}
}
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index 27e3b08..d3f63b4 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -645,6 +645,15 @@ public final class Display {
|| uid == 0;
}
+ /**
+ * Returns true if the display is a public presentation display.
+ * @hide
+ */
+ public boolean isPublicPresentation() {
+ return (mFlags & (Display.FLAG_PRIVATE | Display.FLAG_PRESENTATION)) ==
+ Display.FLAG_PRESENTATION;
+ }
+
private void updateDisplayInfoLocked() {
// Note: The display manager caches display info objects on our behalf.
DisplayInfo newInfo = mGlobal.getDisplayInfo(mDisplayId);
diff --git a/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java b/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java
index e300021..268dcf6 100644
--- a/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java
+++ b/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java
@@ -501,7 +501,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
final RouteInfo route = (RouteInfo) item;
if (type == VIEW_ROUTE) {
- mRouter.selectRouteInt(mRouteTypes, route);
+ mRouter.selectRouteInt(mRouteTypes, route, true);
dismiss();
} else if (type == VIEW_GROUPING_ROUTE) {
final Checkable c = (Checkable) view;
@@ -514,7 +514,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
if (mRouter.getSelectedRoute(mRouteTypes) == oldGroup) {
// Old group was selected but is now empty. Select the group
// we're manipulating since that's where the last route went.
- mRouter.selectRouteInt(mRouteTypes, mEditingGroup);
+ mRouter.selectRouteInt(mRouteTypes, mEditingGroup, true);
}
oldGroup.removeRoute(route);
mEditingGroup.addRoute(route);
@@ -555,7 +555,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
mEditingGroup = group;
mCategoryEditingGroups = group.getCategory();
getDialog().setCanceledOnTouchOutside(false);
- mRouter.selectRouteInt(mRouteTypes, mEditingGroup);
+ mRouter.selectRouteInt(mRouteTypes, mEditingGroup, true);
update();
scrollToEditingGroup();
}