diff options
author | Adam Powell <adamp@google.com> | 2012-10-04 16:26:53 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2012-10-04 16:28:53 -0700 |
commit | 11b999d0aaca72a33526795b6849b473cc3dd569 (patch) | |
tree | df262b0bfc4235bd2a2fc4c2cb81d344d807e78f /media/java | |
parent | dce8b948320e933e46e4a38c496f56555472495f (diff) | |
download | frameworks_base-11b999d0aaca72a33526795b6849b473cc3dd569.zip frameworks_base-11b999d0aaca72a33526795b6849b473cc3dd569.tar.gz frameworks_base-11b999d0aaca72a33526795b6849b473cc3dd569.tar.bz2 |
MediaRouter/Wireless Display - correct initial state
Make sure we get the right initial status for wifi displays when a new
display route is first added to the MediaRouter.
Bug 7289746
Change-Id: Id41f704fc88021bd4cdf21e9f4b3c810775e1aea
Diffstat (limited to 'media/java')
-rw-r--r-- | media/java/android/media/MediaRouter.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java index e5b9637..a4516ab 100644 --- a/media/java/android/media/MediaRouter.java +++ b/media/java/android/media/MediaRouter.java @@ -704,7 +704,8 @@ public class MediaRouter { final WifiDisplay d = newDisplays[i]; final WifiDisplay oldRemembered = findMatchingDisplay(d, oldDisplays); if (oldRemembered == null) { - addRouteStatic(makeWifiDisplayRoute(d)); + addRouteStatic(makeWifiDisplayRoute(d, + findMatchingDisplay(d, availableDisplays) != null)); needScan = true; } else { final boolean available = findMatchingDisplay(d, availableDisplays) != null; @@ -733,15 +734,16 @@ public class MediaRouter { sStatic.mLastKnownWifiDisplayStatus = newStatus; } - static RouteInfo makeWifiDisplayRoute(WifiDisplay display) { + static RouteInfo makeWifiDisplayRoute(WifiDisplay display, boolean available) { final RouteInfo newRoute = new RouteInfo(sStatic.mSystemCategory); newRoute.mDeviceAddress = display.getDeviceAddress(); newRoute.mSupportedTypes = ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO; newRoute.mVolumeHandling = RouteInfo.PLAYBACK_VOLUME_FIXED; newRoute.mPlaybackType = RouteInfo.PLAYBACK_TYPE_REMOTE; - newRoute.mStatus = sStatic.mResources.getText( - com.android.internal.R.string.media_route_status_connecting); - newRoute.mEnabled = false; + + newRoute.setStatusCode(available ? + RouteInfo.STATUS_AVAILABLE : RouteInfo.STATUS_CONNECTING); + newRoute.mEnabled = available; newRoute.mName = makeWifiDisplayName(display); return newRoute; |