summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2012-10-08 20:54:55 -0700
committerAdam Powell <adamp@google.com>2012-10-08 20:56:35 -0700
commitb072a9686c29bfbc05b732076a4e89bcca8db08a (patch)
treee13f9a2e6e17fa0c9506d97f6f173ecf5d57ff9c /media
parentbb5f014ae805f166328d72cbf826e8f1f17c9daf (diff)
downloadframeworks_base-b072a9686c29bfbc05b732076a4e89bcca8db08a.zip
frameworks_base-b072a9686c29bfbc05b732076a4e89bcca8db08a.tar.gz
frameworks_base-b072a9686c29bfbc05b732076a4e89bcca8db08a.tar.bz2
Don't do a wifi p2p scan in MediaRouter if we're already connected
When we're connected to a wifi display already, some configurations might hiccup or otherwise disrupt the media stream if we initiate a new scan. Block the MediaRouter's default scanning behavior if we start up while already connected to a wifi display. (A scan will still occur if the user opens the picker dialog.) Change-Id: I413efa883eec41fe0377da18bcb55bc72e2ac729
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/MediaRouter.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java
index a4516ab..16ad74f 100644
--- a/media/java/android/media/MediaRouter.java
+++ b/media/java/android/media/MediaRouter.java
@@ -693,7 +693,8 @@ public class MediaRouter {
final WifiDisplayStatus oldStatus = sStatic.mLastKnownWifiDisplayStatus;
// TODO Naive implementation. Make this smarter later.
- boolean needScan = false;
+ boolean wantScan = false;
+ boolean blockScan = false;
WifiDisplay[] oldDisplays = oldStatus != null ?
oldStatus.getRememberedDisplays() : new WifiDisplay[0];
WifiDisplay[] newDisplays = newStatus.getRememberedDisplays();
@@ -706,7 +707,7 @@ public class MediaRouter {
if (oldRemembered == null) {
addRouteStatic(makeWifiDisplayRoute(d,
findMatchingDisplay(d, availableDisplays) != null));
- needScan = true;
+ wantScan = true;
} else {
final boolean available = findMatchingDisplay(d, availableDisplays) != null;
final RouteInfo route = findWifiDisplayRoute(d);
@@ -716,6 +717,10 @@ public class MediaRouter {
final RouteInfo activeRoute = findWifiDisplayRoute(d);
if (activeRoute != null) {
selectRouteStatic(activeRoute.getSupportedTypes(), activeRoute);
+
+ // Don't scan if we're already connected to a wifi display,
+ // the scanning process can cause a hiccup with some configurations.
+ blockScan = true;
}
}
}
@@ -727,7 +732,7 @@ public class MediaRouter {
}
}
- if (needScan) {
+ if (wantScan && !blockScan) {
sStatic.mDisplayService.scanWifiDisplays();
}