summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2012-06-21 15:44:47 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-06-21 15:44:47 -0700
commit95cf8c1121a95750358ee99169c96d8d4dfb4950 (patch)
treee7a278bd58e598a63d368740cb5589cca3091b4f
parente06e1619a153a902083d2a1a0c01c86d3c7e546e (diff)
parentf7e0a328c939fa61792d4b685e8f9047a3a0ad90 (diff)
downloadframeworks_base-95cf8c1121a95750358ee99169c96d8d4dfb4950.zip
frameworks_base-95cf8c1121a95750358ee99169c96d8d4dfb4950.tar.gz
frameworks_base-95cf8c1121a95750358ee99169c96d8d4dfb4950.tar.bz2
Merge "Allow ungrouping media routes when a group is the only alternate route" into jb-dev
-rw-r--r--core/java/android/app/MediaRouteButton.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/java/android/app/MediaRouteButton.java b/core/java/android/app/MediaRouteButton.java
index 18713f5..5863ad0 100644
--- a/core/java/android/app/MediaRouteButton.java
+++ b/core/java/android/app/MediaRouteButton.java
@@ -25,6 +25,7 @@ import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.media.MediaRouter;
+import android.media.MediaRouter.RouteGroup;
import android.media.MediaRouter.RouteInfo;
import android.util.AttributeSet;
import android.util.Log;
@@ -157,8 +158,13 @@ public class MediaRouteButton extends View {
final int N = mRouter.getRouteCount();
int count = 0;
for (int i = 0; i < N; i++) {
- if ((mRouter.getRouteAt(i).getSupportedTypes() & mRouteTypes) != 0) {
- count++;
+ final RouteInfo route = mRouter.getRouteAt(i);
+ if ((route.getSupportedTypes() & mRouteTypes) != 0) {
+ if (route instanceof RouteGroup) {
+ count += ((RouteGroup) route).getRouteCount();
+ } else {
+ count++;
+ }
}
}