MediaRoute2Info.Builder
  public
  static
  final
  
  class
  MediaRoute2Info.Builder
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.media.MediaRoute2Info.Builder | 
Builder for media route info.
Summary
| Public constructors | |
|---|---|
| 
      Builder(MediaRoute2Info routeInfo)
      Constructor for builder to create  | |
| 
      Builder(String id, CharSequence name)
      Constructor for builder to create  | |
| Public methods | |
|---|---|
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      addFeature(String feature)
      Adds a feature for the route. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      addFeatures(Collection<String> features)
      Adds features for the route. | 
| 
        
        
        
        
        
        MediaRoute2Info | 
      build()
      Builds the  | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      clearFeatures()
      Clears the features of the route. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setClientPackageName(String packageName)
      Sets the package name of the app using the route. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setConnectionState(int connectionState)
      Sets the route's connection state. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setDeduplicationIds(Set<String> id)
      Sets the  | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setDescription(CharSequence description)
      Sets the user-visible description of the route. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setExtras(Bundle extras)
      Sets a bundle of extras for the route. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setIconUri(Uri iconUri)
      Sets the URI of the icon representing this route. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setRequiredPermissions(Set<String> requiredPermissions)
      Limits the visibility of this route to holders of a set of permissions. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setRequiredPermissions(List<Set<String>> requiresOneOf)
      Limits the visibility of this route to holders of one of a set of permissions. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setSuitabilityStatus(int suitabilityStatus)
      Sets route suitability status. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setType(int type)
      Sets the route's type. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setVisibilityPublic()
      Sets the visibility of this route to public. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setVisibilityRestricted(Set<String> allowedPackages)
      Sets the visibility of this route to restricted. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setVisibilityRestricted(Set<String> allowedPackages, boolean alsoAllowPrivileged)
      Sets the visibility of this route to restricted. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setVolume(int volume)
      Sets the route's current volume, or 0 if unknown. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setVolumeHandling(int volumeHandling)
      Sets the route's volume handling. | 
| 
        
        
        
        
        
        MediaRoute2Info.Builder | 
      setVolumeMax(int volumeMax)
      Sets the route's maximum volume, or 0 if unknown. | 
| Inherited methods | |
|---|---|
Public constructors
Builder
public Builder (MediaRoute2Info routeInfo)
Constructor for builder to create MediaRoute2Info with existing
 MediaRoute2Info instance.
| Parameters | |
|---|---|
| routeInfo | MediaRoute2Info: the existing instance to copy data from.
 This value cannot benull. | 
Builder
public Builder (String id, CharSequence name)
Constructor for builder to create MediaRoute2Info.
 
 In order to ensure ID uniqueness, the ID of a route info
 obtained from MediaRouter2 can be different from what was set in
 MediaRoute2ProviderService.
 
| Parameters | |
|---|---|
| id | String: The ID of the route. Must not be empty.
 This value cannot benull. | 
| name | CharSequence: The user-visible name of the route.
 This value cannot benull. | 
Public methods
addFeature
public MediaRoute2Info.Builder addFeature (String feature)
Adds a feature for the route.
| Parameters | |
|---|---|
| feature | String: a feature that the route has. May be one of predefined features
                such asMediaRoute2Info.FEATURE_LIVE_AUDIO,MediaRoute2Info.FEATURE_LIVE_VIDEOorMediaRoute2Info.FEATURE_REMOTE_PLAYBACKor a custom feature defined by
                a provider.
 This value cannot benull. | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
See also:
addFeatures
public MediaRoute2Info.Builder addFeatures (Collection<String> features)
Adds features for the route. A route must support at least one route type.
| Parameters | |
|---|---|
| features | Collection: features that the route has. May include predefined features
                such asMediaRoute2Info.FEATURE_LIVE_AUDIO,MediaRoute2Info.FEATURE_LIVE_VIDEOorMediaRoute2Info.FEATURE_REMOTE_PLAYBACKor custom features defined by
                a provider.
 This value cannot benull. | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
See also:
build
public MediaRoute2Info build ()
Builds the media route info.
| Returns | |
|---|---|
| MediaRoute2Info | This value cannot be null. | 
| Throws | |
|---|---|
| IllegalArgumentException | if no features are added. | 
clearFeatures
public MediaRoute2Info.Builder clearFeatures ()
Clears the features of the route. A route must support at least one route type.
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setClientPackageName
public MediaRoute2Info.Builder setClientPackageName (String packageName)
Sets the package name of the app using the route.
| Parameters | |
|---|---|
| packageName | String: This value may benull. | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setConnectionState
public MediaRoute2Info.Builder setConnectionState (int connectionState)
Sets the route's connection state.
 MediaRoute2Info.CONNECTION_STATE_DISCONNECTED,
 MediaRoute2Info.CONNECTION_STATE_CONNECTING, or
 MediaRoute2Info.CONNECTION_STATE_CONNECTED.
| Parameters | |
|---|---|
| connectionState | int: Value isMediaRoute2Info.CONNECTION_STATE_DISCONNECTED,MediaRoute2Info.CONNECTION_STATE_CONNECTING, orMediaRoute2Info.CONNECTION_STATE_CONNECTED | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setDeduplicationIds
public MediaRoute2Info.Builder setDeduplicationIds (Set<String> id)
Sets the deduplication IDs of the route.
| Parameters | |
|---|---|
| id | Set: This value cannot benull. | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setDescription
public MediaRoute2Info.Builder setDescription (CharSequence description)
Sets the user-visible description of the route.
| Parameters | |
|---|---|
| description | CharSequence: This value may benull. | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setExtras
public MediaRoute2Info.Builder setExtras (Bundle extras)
Sets a bundle of extras for the route.
 Note: The extras will not affect the result of MediaRoute2Info.equals(Object).
| Parameters | |
|---|---|
| extras | Bundle: This value may benull. | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setIconUri
public MediaRoute2Info.Builder setIconUri (Uri iconUri)
Sets the URI of the icon representing this route.
This icon will be used in picker UIs if available.
The URI must be one of the following formats:
- content (ContentResolver.SCHEME_CONTENT)
- android.resource (ContentResolver.SCHEME_ANDROID_RESOURCE)
- file (ContentResolver.SCHEME_FILE)
| Parameters | |
|---|---|
| iconUri | Uri: This value may benull. | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setRequiredPermissions
public MediaRoute2Info.Builder setRequiredPermissions (Set<String> requiredPermissions)
Limits the visibility of this route to holders of a set of permissions.
Calls to this method override any previous calls of
 setRequiredPermissions(java.util.Set) or setRequiredPermissions(java.util.List).
| Parameters | |
|---|---|
| requiredPermissions | Set: the list of all permissions which must be held in order to
                            see this route.
 This value cannot benull. | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setRequiredPermissions
public MediaRoute2Info.Builder setRequiredPermissions (List<Set<String>> requiresOneOf)
Limits the visibility of this route to holders of one of a set of permissions.
Calls to this method override any previous calls of
 setRequiredPermissions(java.util.Set) or setRequiredPermissions(java.util.List).
| Parameters | |
|---|---|
| requiresOneOf | List: a list of Sets of permissions. Holding all permissions in at least
                      one of the Sets is required for the route to be visible.
 This value cannot benull. | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setSuitabilityStatus
public MediaRoute2Info.Builder setSuitabilityStatus (int suitabilityStatus)
Sets route suitability status.
The default value is MediaRoute2Info.SUITABILITY_STATUS_SUITABLE_FOR_DEFAULT_TRANSFER.
 
 Apps are not supposed to set MediaRoute2Info.SUITABILITY_STATUS_NOT_SUITABLE_FOR_TRANSFER. Publishing a non-system
 route with such status throws SecurityException.
| Parameters | |
|---|---|
| suitabilityStatus | int: Value isMediaRoute2Info.SUITABILITY_STATUS_SUITABLE_FOR_DEFAULT_TRANSFER,MediaRoute2Info.SUITABILITY_STATUS_SUITABLE_FOR_MANUAL_TRANSFER, orMediaRoute2Info.SUITABILITY_STATUS_NOT_SUITABLE_FOR_TRANSFER | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setType
public MediaRoute2Info.Builder setType (int type)
Sets the route's type.
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
See also:
setVisibilityPublic
public MediaRoute2Info.Builder setVisibilityPublic ()
Sets the visibility of this route to public.
By default, unless you call setVisibilityRestricted(Set), the new route will be
 public.
 
Public routes are visible to any application with a matching feature.
 
Calls to this method override previous calls to setVisibilityPublic() and
 setVisibilityRestricted(Set).
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setVisibilityRestricted
public MediaRoute2Info.Builder setVisibilityRestricted (Set<String> allowedPackages)
Sets the visibility of this route to restricted.
Routes with restricted visibility are only visible to its publisher application and
 applications whose package name is included in the provided allowedPackages set
 with a matching feature.
 
Calls to this method override previous calls to setVisibilityPublic() and
 setVisibilityRestricted(Set).
| Parameters | |
|---|---|
| allowedPackages | Set: set of package names which are allowed to see this route.
 This value cannot benull. | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
See also:
setVisibilityRestricted
public MediaRoute2Info.Builder setVisibilityRestricted (Set<String> allowedPackages, boolean alsoAllowPrivileged)
Sets the visibility of this route to restricted.
| Parameters | |
|---|---|
| allowedPackages | Set: set of package names which are allowed to see this route.
 This value cannot benull. | 
| alsoAllowPrivileged | boolean: whether packages not explicitly listed in allowedPackages, but
              holdingprivileged routing permissions, can also see this route. | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setVolume
public MediaRoute2Info.Builder setVolume (int volume)
Sets the route's current volume, or 0 if unknown.
| Parameters | |
|---|---|
| volume | int | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setVolumeHandling
public MediaRoute2Info.Builder setVolumeHandling (int volumeHandling)
Sets the route's volume handling.
| Parameters | |
|---|---|
| volumeHandling | int: Value isMediaRoute2Info.PLAYBACK_VOLUME_FIXED, orMediaRoute2Info.PLAYBACK_VOLUME_VARIABLE | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
setVolumeMax
public MediaRoute2Info.Builder setVolumeMax (int volumeMax)
Sets the route's maximum volume, or 0 if unknown.
| Parameters | |
|---|---|
| volumeMax | int | 
| Returns | |
|---|---|
| MediaRoute2Info.Builder | This value cannot be null. | 
