2222import android .content .Intent ;
2323import android .content .IntentFilter ;
2424import android .content .res .Resources ;
25+ import android .graphics .drawable .Drawable ;
2526import android .os .Handler ;
2627import android .util .Log ;
2728
@@ -492,6 +493,7 @@ public static class RouteInfo {
492493 int mSupportedTypes ;
493494 RouteGroup mGroup ;
494495 final RouteCategory mCategory ;
496+ Drawable mIcon ;
495497
496498 RouteInfo (RouteCategory category ) {
497499 mCategory = category ;
@@ -534,6 +536,16 @@ public RouteCategory getCategory() {
534536 return mCategory ;
535537 }
536538
539+ /**
540+ * Get the icon representing this route.
541+ * This icon will be used in picker UIs if available.
542+ *
543+ * @return the icon representing this route or null if no icon is available
544+ */
545+ public Drawable getIconDrawable () {
546+ return mIcon ;
547+ }
548+
537549 void setStatusInt (CharSequence status ) {
538550 if (!status .equals (mStatus )) {
539551 mStatus = status ;
@@ -564,6 +576,7 @@ public String toString() {
564576 * @see MediaRouter.RouteInfo
565577 */
566578 public static class UserRouteInfo extends RouteInfo {
579+ RemoteControlClient mRcc ;
567580
568581 UserRouteInfo (RouteCategory category ) {
569582 super (category );
@@ -587,6 +600,40 @@ public void setName(CharSequence name) {
587600 public void setStatus (CharSequence status ) {
588601 setStatusInt (status );
589602 }
603+
604+ /**
605+ * Set the RemoteControlClient responsible for reporting playback info for this
606+ * user route.
607+ *
608+ * <p>If this route manages remote playback, the data exposed by this
609+ * RemoteControlClient will be used to reflect and update information
610+ * such as route volume info in related UIs.</p>
611+ *
612+ * @param rcc RemoteControlClient associated with this route
613+ */
614+ public void setRemoteControlClient (RemoteControlClient rcc ) {
615+ mRcc = rcc ;
616+ }
617+
618+ /**
619+ * Set an icon that will be used to represent this route.
620+ * The system may use this icon in picker UIs or similar.
621+ *
622+ * @param icon icon drawable to use to represent this route
623+ */
624+ public void setIconDrawable (Drawable icon ) {
625+ mIcon = icon ;
626+ }
627+
628+ /**
629+ * Set an icon that will be used to represent this route.
630+ * The system may use this icon in picker UIs or similar.
631+ *
632+ * @param icon Resource ID of an icon drawable to use to represent this route
633+ */
634+ public void setIconResource (int resId ) {
635+ setIconDrawable (sStatic .mResources .getDrawable (resId ));
636+ }
590637 }
591638
592639 /**
@@ -695,6 +742,26 @@ public RouteInfo getRouteAt(int index) {
695742 return mRoutes .get (index );
696743 }
697744
745+ /**
746+ * Set an icon that will be used to represent this group.
747+ * The system may use this icon in picker UIs or similar.
748+ *
749+ * @param icon icon drawable to use to represent this group
750+ */
751+ public void setIconDrawable (Drawable icon ) {
752+ mIcon = icon ;
753+ }
754+
755+ /**
756+ * Set an icon that will be used to represent this group.
757+ * The system may use this icon in picker UIs or similar.
758+ *
759+ * @param icon Resource ID of an icon drawable to use to represent this group
760+ */
761+ public void setIconResource (int resId ) {
762+ setIconDrawable (sStatic .mResources .getDrawable (resId ));
763+ }
764+
698765 void memberNameChanged (RouteInfo info , CharSequence name ) {
699766 mUpdateName = true ;
700767 routeUpdated ();
0 commit comments