Builder
class Builder
kotlin.Any | |
↳ | android.media.MediaRoute2Info.Builder |
Builder for media route info
.
Summary
Public constructors | |
---|---|
Builder(id: String, name: CharSequence) Constructor for builder to create |
|
Builder(routeInfo: MediaRoute2Info) Constructor for builder to create |
Public methods | |
---|---|
MediaRoute2Info.Builder |
addFeature(feature: String) Adds a feature for the route. |
MediaRoute2Info.Builder |
addFeatures(features: MutableCollection<String!>) Adds features for the route. |
MediaRoute2Info |
build() Builds the |
MediaRoute2Info.Builder |
Clears the features of the route. |
MediaRoute2Info.Builder |
setClientPackageName(packageName: String?) Sets the package name of the app using the route. |
MediaRoute2Info.Builder |
setConnectionState(connectionState: Int) Sets the route's connection state. |
MediaRoute2Info.Builder |
setDeduplicationIds(id: MutableSet<String!>) Sets the |
MediaRoute2Info.Builder |
setDescription(description: CharSequence?) Sets the user-visible description of the route. |
MediaRoute2Info.Builder |
Sets a bundle of extras for the route. |
MediaRoute2Info.Builder |
setIconUri(iconUri: Uri?) Sets the URI of the icon representing this route. |
MediaRoute2Info.Builder |
setSuitabilityStatus(suitabilityStatus: Int) Sets route suitability status. |
MediaRoute2Info.Builder |
Sets the route's type. |
MediaRoute2Info.Builder |
Sets the visibility of this route to public. |
MediaRoute2Info.Builder |
setVisibilityRestricted(allowedPackages: MutableSet<String!>) Sets the visibility of this route to restricted. |
MediaRoute2Info.Builder |
Sets the route's current volume, or 0 if unknown. |
MediaRoute2Info.Builder |
setVolumeHandling(volumeHandling: Int) Sets the route's volume handling. |
MediaRoute2Info.Builder |
setVolumeMax(volumeMax: Int) Sets the route's maximum volume, or 0 if unknown. |
Public constructors
Builder
Builder(
id: String,
name: CharSequence)
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 be null . |
name |
CharSequence: The user-visible name of the route. This value cannot be null . |
Builder
Builder(routeInfo: MediaRoute2Info)
Constructor for builder to create MediaRoute2Info
with existing MediaRoute2Info
instance.
Parameters | |
---|---|
routeInfo |
MediaRoute2Info: the existing instance to copy data from. This value cannot be null . |
Public methods
addFeature
fun addFeature(feature: String): MediaRoute2Info.Builder
Adds a feature for the route.
Parameters | |
---|---|
feature |
String: a feature that the route has. May be one of predefined features such as FEATURE_LIVE_AUDIO , FEATURE_LIVE_VIDEO or FEATURE_REMOTE_PLAYBACK or a custom feature defined by a provider. This value cannot be null . |
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
See Also
addFeatures
fun addFeatures(features: MutableCollection<String!>): MediaRoute2Info.Builder
Adds features for the route. A route must support at least one route type.
Parameters | |
---|---|
features |
MutableCollection<String!>: features that the route has. May include predefined features such as FEATURE_LIVE_AUDIO , FEATURE_LIVE_VIDEO or FEATURE_REMOTE_PLAYBACK or custom features defined by a provider. This value cannot be null . |
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
See Also
build
fun build(): MediaRoute2Info
Builds the media route info
.
Return | |
---|---|
MediaRoute2Info |
This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if no features are added. |
clearFeatures
fun clearFeatures(): MediaRoute2Info.Builder
Clears the features of the route. A route must support at least one route type.
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setClientPackageName
fun setClientPackageName(packageName: String?): MediaRoute2Info.Builder
Sets the package name of the app using the route.
Parameters | |
---|---|
packageName |
String?: This value may be null . |
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setConnectionState
fun setConnectionState(connectionState: Int): MediaRoute2Info.Builder
Sets the route's connection state. CONNECTION_STATE_DISCONNECTED
, CONNECTION_STATE_CONNECTING
, or CONNECTION_STATE_CONNECTED
.
Parameters | |
---|---|
connectionState |
Int: Value is android.media.MediaRoute2Info#CONNECTION_STATE_DISCONNECTED , android.media.MediaRoute2Info#CONNECTION_STATE_CONNECTING , or android.media.MediaRoute2Info#CONNECTION_STATE_CONNECTED |
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setDeduplicationIds
fun setDeduplicationIds(id: MutableSet<String!>): MediaRoute2Info.Builder
Sets the deduplication IDs
of the route.
Parameters | |
---|---|
id |
MutableSet<String!>: This value cannot be null . |
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setDescription
fun setDescription(description: CharSequence?): MediaRoute2Info.Builder
Sets the user-visible description of the route.
Parameters | |
---|---|
description |
CharSequence?: This value may be null . |
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setExtras
fun setExtras(extras: Bundle?): MediaRoute2Info.Builder
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 be null . |
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setIconUri
fun setIconUri(iconUri: Uri?): MediaRoute2Info.Builder
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 (
android.content.ContentResolver#SCHEME_CONTENT
) - android.resource (
android.content.ContentResolver#SCHEME_ANDROID_RESOURCE
) - file (
android.content.ContentResolver#SCHEME_FILE
)
Parameters | |
---|---|
iconUri |
Uri?: This value may be null . |
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setSuitabilityStatus
fun setSuitabilityStatus(suitabilityStatus: Int): MediaRoute2Info.Builder
Sets route suitability status.
The default value is android.media.MediaRoute2Info#SUITABILITY_STATUS_SUITABLE_FOR_DEFAULT_TRANSFER
.
Apps are not supposed to set android.media.MediaRoute2Info#SUITABILITY_STATUS_NOT_SUITABLE_FOR_TRANSFER
. Publishing a non-system route with such status throws SecurityException
.
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setType
fun setType(type: Int): MediaRoute2Info.Builder
Sets the route's type.
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setVisibilityPublic
fun setVisibilityPublic(): MediaRoute2Info.Builder
Sets the visibility of this route to public.
By default, unless you call setVisibilityRestricted
, 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
.
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setVisibilityRestricted
fun setVisibilityRestricted(allowedPackages: MutableSet<String!>): MediaRoute2Info.Builder
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
.
Parameters | |
---|---|
allowedPackages |
MutableSet<String!>: set of package names which are allowed to see this route. This value cannot be null . |
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
See Also
setVolume
fun setVolume(volume: Int): MediaRoute2Info.Builder
Sets the route's current volume, or 0 if unknown.
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setVolumeHandling
fun setVolumeHandling(volumeHandling: Int): MediaRoute2Info.Builder
Sets the route's volume handling.
Parameters | |
---|---|
volumeHandling |
Int: Value is android.media.MediaRoute2Info#PLAYBACK_VOLUME_FIXED , or android.media.MediaRoute2Info#PLAYBACK_VOLUME_VARIABLE |
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |
setVolumeMax
fun setVolumeMax(volumeMax: Int): MediaRoute2Info.Builder
Sets the route's maximum volume, or 0 if unknown.
Return | |
---|---|
MediaRoute2Info.Builder |
This value cannot be null . |