Builder
class Builder
kotlin.Any | |
↳ | android.media.RoutingSessionInfo.Builder |
Builder class for RoutingSessionInfo
.
Summary
Public constructors | |
---|---|
Builder(sessionInfo: RoutingSessionInfo) Constructor for builder to create |
|
Constructor for builder to create |
Public methods | |
---|---|
RoutingSessionInfo.Builder |
addDeselectableRoute(routeId: String) Adds a route to the deselectable routes. |
RoutingSessionInfo.Builder |
addSelectableRoute(routeId: String) Adds a route to the selectable routes. |
RoutingSessionInfo.Builder |
addSelectedRoute(routeId: String) Adds a route to the selected routes. |
RoutingSessionInfo.Builder |
addTransferableRoute(routeId: String) Adds a route to the transferable routes. |
RoutingSessionInfo |
build() 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 |
removeDeselectableRoute(routeId: String) Removes a route from the deselectable routes. |
RoutingSessionInfo.Builder |
removeSelectableRoute(routeId: String) Removes a route from the selectable routes. |
RoutingSessionInfo.Builder |
removeSelectedRoute(routeId: String) Removes a route from the selected routes. |
RoutingSessionInfo.Builder |
removeTransferableRoute(routeId: String) Removes a route from the transferable routes. |
RoutingSessionInfo.Builder |
setControlHints(controlHints: Bundle?) Sets control hints. |
RoutingSessionInfo.Builder |
setName(name: CharSequence?) Sets the user-visible name of the session. |
RoutingSessionInfo.Builder |
setTransferInitiator(transferInitiatorUserHandle: UserHandle?, transferInitiatorPackageName: String?) Sets the user handle and package name of the process that initiated the transfer. |
RoutingSessionInfo.Builder |
setTransferReason(transferReason: Int) Sets transfer reason for the current session. |
RoutingSessionInfo.Builder |
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
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 . |
Builder
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 . |
Public methods
addDeselectableRoute
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
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
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
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
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
fun clearDeselectableRoutes(): RoutingSessionInfo.Builder
Clears the deselectable routes.
Return | |
---|---|
RoutingSessionInfo.Builder |
This value cannot be null . |
clearSelectableRoutes
fun clearSelectableRoutes(): RoutingSessionInfo.Builder
Clears the selectable routes.
Return | |
---|---|
RoutingSessionInfo.Builder |
This value cannot be null . |
clearSelectedRoutes
fun clearSelectedRoutes(): RoutingSessionInfo.Builder
Clears the selected routes.
Return | |
---|---|
RoutingSessionInfo.Builder |
This value cannot be null . |
clearTransferableRoutes
fun clearTransferableRoutes(): RoutingSessionInfo.Builder
Clears the transferable routes.
Return | |
---|---|
RoutingSessionInfo.Builder |
This value cannot be null . |
removeDeselectableRoute
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
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
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
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
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
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 . |
setTransferInitiator
fun setTransferInitiator(
transferInitiatorUserHandle: UserHandle?,
transferInitiatorPackageName: String?
): RoutingSessionInfo.Builder
Sets the user handle and package name of the process that initiated the transfer.
By default the transfer initiation user handle and package name are set to null
.
Parameters | |
---|---|
transferInitiatorUserHandle |
UserHandle?: This value may be null . |
transferInitiatorPackageName |
String?: This value may be null . |
setTransferReason
fun setTransferReason(transferReason: Int): RoutingSessionInfo.Builder
Sets transfer reason for the current session.
By default the transfer reason is set to android.media.RoutingSessionInfo#TRANSFER_REASON_FALLBACK
.
Parameters | |
---|---|
transferReason |
Int: Value is android.media.RoutingSessionInfo#TRANSFER_REASON_FALLBACK , android.media.RoutingSessionInfo#TRANSFER_REASON_SYSTEM_REQUEST , or android.media.RoutingSessionInfo#TRANSFER_REASON_APP |
Return | |
---|---|
RoutingSessionInfo.Builder |
This value cannot be null . |
setVolume
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
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
fun setVolumeMax(volumeMax: Int): RoutingSessionInfo.Builder
Sets the session's maximum volume, or 0 if unknown.
Return | |
---|---|
RoutingSessionInfo.Builder |
This value cannot be null . |