Added in API level 30

Builder

class Builder
kotlin.Any
   ↳ android.media.RoutingSessionInfo.Builder

Builder class for RoutingSessionInfo.

Summary

Public constructors
Builder(id: String, clientPackageName: String)

Constructor for builder to create RoutingSessionInfo.

Constructor for builder to create RoutingSessionInfo with existing RoutingSessionInfo instance.

Public methods
RoutingSessionInfo.Builder

Adds a route to the deselectable routes.

RoutingSessionInfo.Builder

Adds a route to the selectable routes.

RoutingSessionInfo.Builder

Adds a route to the selected routes.

RoutingSessionInfo.Builder

Adds a route to the transferable routes.

RoutingSessionInfo

Builds a routing session info.

RoutingSessionInfo.Builder

Clears the deselectable routes.

RoutingSessionInfo.Builder

Clears the selectable routes.

RoutingSessionInfo.Builder

Clears the selected routes.

RoutingSessionInfo.Builder

Clears the transferable routes.

RoutingSessionInfo.Builder

Removes a route from the deselectable routes.

RoutingSessionInfo.Builder

Removes a route from the selectable routes.

RoutingSessionInfo.Builder

Removes a route from the selected routes.

RoutingSessionInfo.Builder

Removes a route from the transferable routes.

RoutingSessionInfo.Builder
setControlHints(controlHints: Bundle?)

Sets control hints.

RoutingSessionInfo.Builder

Sets the user-visible name of the session.

RoutingSessionInfo.Builder
setVolume(volume: Int)

Sets the session's current volume, or 0 if unknown.

RoutingSessionInfo.Builder
setVolumeHandling(volumeHandling: Int)

Sets the session's volume handling.

RoutingSessionInfo.Builder
setVolumeMax(volumeMax: Int)

Sets the session's maximum volume, or 0 if unknown.

Public constructors

Builder

Added in API level 30
Builder(
    id: String,
    clientPackageName: String)

Constructor for builder to create RoutingSessionInfo.

In order to ensure ID uniqueness in MediaRouter2 side, the value of RoutingSessionInfo#getId() can be different from what was set in MediaRoute2ProviderService.

Parameters
id String: ID of the session. Must not be empty. This value cannot be null.
clientPackageName String: package name of the client app which uses this session. If is is unknown, then just use an empty string. This value cannot be null.

Builder

Added in API level 30
Builder(sessionInfo: RoutingSessionInfo)

Constructor for builder to create RoutingSessionInfo with existing RoutingSessionInfo instance.

Parameters
sessionInfo RoutingSessionInfo: the existing instance to copy data from. This value cannot be null.

Public methods

addDeselectableRoute

Added in API level 30
fun addDeselectableRoute(routeId: String): RoutingSessionInfo.Builder

Adds a route to the deselectable routes. The routeId must not be empty.

Parameters
routeId String: This value cannot be null.
Return
RoutingSessionInfo.Builder This value cannot be null.

addSelectableRoute

Added in API level 30
fun addSelectableRoute(routeId: String): RoutingSessionInfo.Builder

Adds a route to the selectable routes. The routeId must not be empty.

Parameters
routeId String: This value cannot be null.
Return
RoutingSessionInfo.Builder This value cannot be null.

addSelectedRoute

Added in API level 30
fun addSelectedRoute(routeId: String): RoutingSessionInfo.Builder

Adds a route to the selected routes. The routeId must not be empty.

Parameters
routeId String: This value cannot be null.
Return
RoutingSessionInfo.Builder This value cannot be null.

addTransferableRoute

Added in API level 30
fun addTransferableRoute(routeId: String): RoutingSessionInfo.Builder

Adds a route to the transferable routes. The routeId must not be empty.

Parameters
routeId String: This value cannot be null.
Return
RoutingSessionInfo.Builder This value cannot be null.

build

Added in API level 30
fun build(): RoutingSessionInfo

Builds a routing session info.

Return
RoutingSessionInfo This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if no selected routes are added.

clearDeselectableRoutes

Added in API level 30
fun clearDeselectableRoutes(): RoutingSessionInfo.Builder

Clears the deselectable routes.

Return
RoutingSessionInfo.Builder This value cannot be null.

clearSelectableRoutes

Added in API level 30
fun clearSelectableRoutes(): RoutingSessionInfo.Builder

Clears the selectable routes.

Return
RoutingSessionInfo.Builder This value cannot be null.

clearSelectedRoutes

Added in API level 30
fun clearSelectedRoutes(): RoutingSessionInfo.Builder

Clears the selected routes.

Return
RoutingSessionInfo.Builder This value cannot be null.

clearTransferableRoutes

Added in API level 30
fun clearTransferableRoutes(): RoutingSessionInfo.Builder

Clears the transferable routes.

Return
RoutingSessionInfo.Builder This value cannot be null.

removeDeselectableRoute

Added in API level 30
fun removeDeselectableRoute(routeId: String): RoutingSessionInfo.Builder

Removes a route from the deselectable routes. The routeId must not be empty.

Parameters
routeId String: This value cannot be null.
Return
RoutingSessionInfo.Builder This value cannot be null.

removeSelectableRoute

Added in API level 30
fun removeSelectableRoute(routeId: String): RoutingSessionInfo.Builder

Removes a route from the selectable routes. The routeId must not be empty.

Parameters
routeId String: This value cannot be null.
Return
RoutingSessionInfo.Builder This value cannot be null.

removeSelectedRoute

Added in API level 30
fun removeSelectedRoute(routeId: String): RoutingSessionInfo.Builder

Removes a route from the selected routes. The routeId must not be empty.

Parameters
routeId String: This value cannot be null.
Return
RoutingSessionInfo.Builder This value cannot be null.

removeTransferableRoute

Added in API level 30
fun removeTransferableRoute(routeId: String): RoutingSessionInfo.Builder

Removes a route from the transferable routes. The routeId must not be empty.

Parameters
routeId String: This value cannot be null.
Return
RoutingSessionInfo.Builder This value cannot be null.

setControlHints

Added in API level 30
fun setControlHints(controlHints: Bundle?): RoutingSessionInfo.Builder

Sets control hints.

Parameters
controlHints Bundle?: This value may be null.
Return
RoutingSessionInfo.Builder This value cannot be null.

setName

Added in API level 30
fun setName(name: CharSequence?): RoutingSessionInfo.Builder

Sets the user-visible name of the session.

Parameters
name CharSequence?: This value may be null.
Return
RoutingSessionInfo.Builder This value cannot be null.

setVolume

Added in API level 30
fun setVolume(volume: Int): RoutingSessionInfo.Builder

Sets the session's current volume, or 0 if unknown.

Return
RoutingSessionInfo.Builder This value cannot be null.

setVolumeHandling

Added in API level 30
fun setVolumeHandling(volumeHandling: Int): RoutingSessionInfo.Builder

Sets the session's volume handling. MediaRoute2Info#PLAYBACK_VOLUME_FIXED or MediaRoute2Info#PLAYBACK_VOLUME_VARIABLE.

Parameters
volumeHandling Int: Value is android.media.MediaRoute2Info#PLAYBACK_VOLUME_FIXED, or android.media.MediaRoute2Info#PLAYBACK_VOLUME_VARIABLE
Return
RoutingSessionInfo.Builder This value cannot be null.

setVolumeMax

Added in API level 30
fun setVolumeMax(volumeMax: Int): RoutingSessionInfo.Builder

Sets the session's maximum volume, or 0 if unknown.

Return
RoutingSessionInfo.Builder This value cannot be null.