diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-10-11 14:30:21 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2012-10-11 14:30:21 -0700 |
commit | 2444ae7e2b8658a4a90f996e678423558744b4a2 (patch) | |
tree | fd441892fd995c29310d4cfc5ee6503e159b8a92 /media/java | |
parent | a2f7ca7db1f797d7897dc66840d1ec64d1b2a6a1 (diff) | |
download | frameworks_base-2444ae7e2b8658a4a90f996e678423558744b4a2.zip frameworks_base-2444ae7e2b8658a4a90f996e678423558744b4a2.tar.gz frameworks_base-2444ae7e2b8658a4a90f996e678423558744b4a2.tar.bz2 |
Ensure MediaRouter correctly handles renamed Wifi displays.
Fix a couple of bugs that cause MediaRouter to disconnect from
the current Wifi display whenever it is renamed.
Added an extra check in WifiDisplayAdapter for identity renames.
The Settings app already handles this case but it's good to have
the service check for it as well so we don't store unnecessary
aliases.
Bug: 7310777
Change-Id: I8fddd32ca59f9b798ee31b467b81457508c345f8
Diffstat (limited to 'media/java')
-rw-r--r-- | media/java/android/media/MediaRouter.java | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java index 8e9384ee..82ed432 100644 --- a/media/java/android/media/MediaRouter.java +++ b/media/java/android/media/MediaRouter.java @@ -751,18 +751,10 @@ public class MediaRouter { RouteInfo.STATUS_AVAILABLE : RouteInfo.STATUS_CONNECTING); newRoute.mEnabled = available; - newRoute.mName = makeWifiDisplayName(display); + newRoute.mName = display.getFriendlyDisplayName(); return newRoute; } - static String makeWifiDisplayName(WifiDisplay display) { - String name = display.getDeviceAlias(); - if (TextUtils.isEmpty(name)) { - name = display.getDeviceName(); - } - return name; - } - private static void updateWifiDisplayRoute(RouteInfo route, WifiDisplay display, boolean available, WifiDisplayStatus wifiDisplayStatus) { final boolean isScanning = @@ -792,8 +784,8 @@ public class MediaRouter { } } - final String newName = makeWifiDisplayName(display); - if (route.getName().equals(newName)) { + final String newName = display.getFriendlyDisplayName(); + if (!route.getName().equals(newName)) { route.mName = newName; changed = true; } @@ -814,11 +806,11 @@ public class MediaRouter { } } - private static WifiDisplay findMatchingDisplay(WifiDisplay address, WifiDisplay[] displays) { + private static WifiDisplay findMatchingDisplay(WifiDisplay d, WifiDisplay[] displays) { for (int i = 0; i < displays.length; i++) { - final WifiDisplay d = displays[i]; - if (d.equals(address)) { - return d; + final WifiDisplay other = displays[i]; + if (d.getDeviceAddress().equals(other.getDeviceAddress())) { + return other; } } return null; |