Added in API level 30

StatelessBuilder

class StatelessBuilder
kotlin.Any
   ↳ android.service.controls.Control.StatelessBuilder

Builder class for Control. This class facilitates the creation of Control with no state. Must be used to provide controls for ControlsProviderService#createPublisherForAllAvailable and ControlsProviderService#createPublisherForSuggested. It provides the following defaults for non-optional parameters:

This fixes the values relating to state of the Control as required by ControlsProviderService#createPublisherForAllAvailable:

Summary

Public constructors
StatelessBuilder(controlId: String, appIntent: PendingIntent)

Creates a StatelessBuilder using an existing Control as a base.

Public methods
Control

Control.StatelessBuilder

Control.StatelessBuilder
setControlId(controlId: String)

Control.StatelessBuilder

Optional color to be shown with the Control.

Control.StatelessBuilder
setCustomIcon(customIcon: Icon?)

Optional icon to be shown with the Control.

Control.StatelessBuilder
setDeviceType(deviceType: Int)

Control.StatelessBuilder

Optional top-level group to help define the Control's location, visible to the user.

Control.StatelessBuilder

Control.StatelessBuilder

Control.StatelessBuilder

Optional group name to help define the Control's location within a structure, visible to the user.

Public constructors

StatelessBuilder

Added in API level 30
StatelessBuilder(
    controlId: String,
    appIntent: PendingIntent)
Parameters
controlId String: the identifier for the Control This value cannot be null.
appIntent PendingIntent: the pending intent linking to the device Activity This value cannot be null.

StatelessBuilder

Added in API level 30
StatelessBuilder(control: Control)

Creates a StatelessBuilder using an existing Control as a base.

Parameters
control Control: base for the builder. This value cannot be null.

Public methods

build

Added in API level 30
fun build(): Control
Return
Control a valid Control This value cannot be null.

setAppIntent

Added in API level 30
fun setAppIntent(appIntent: PendingIntent): Control.StatelessBuilder
Parameters
appIntent PendingIntent: a PendingIntent linking to an Activity for the Control This value cannot be null.
Return
Control.StatelessBuilder this This value cannot be null.

setControlId

Added in API level 30
fun setControlId(controlId: String): Control.StatelessBuilder
Parameters
controlId String: the identifier for the Control This value cannot be null.
Return
Control.StatelessBuilder this This value cannot be null.

setCustomColor

Added in API level 30
fun setCustomColor(customColor: ColorStateList?): Control.StatelessBuilder

Optional color to be shown with the Control. It is highly recommended to let the system default the color unless the default is not suitable for the application.

Parameters
customColor ColorStateList?: background color to use This value may be null.
Return
Control.StatelessBuilder this This value cannot be null.

setCustomIcon

Added in API level 30
fun setCustomIcon(customIcon: Icon?): Control.StatelessBuilder

Optional icon to be shown with the Control. It is highly recommended to let the system default the icon unless the default icon is not suitable.

Parameters
customIcon Icon?: icon to show This value may be null.
Return
Control.StatelessBuilder this This value cannot be null.

setDeviceType

Added in API level 30
fun setDeviceType(deviceType: Int): Control.StatelessBuilder
Parameters
deviceType Int: type of device represented by this Control, used to determine the default icon and color Value is android.service.controls.DeviceTypes#TYPE_GENERIC_ON_OFF, android.service.controls.DeviceTypes#TYPE_GENERIC_START_STOP, android.service.controls.DeviceTypes#TYPE_GENERIC_OPEN_CLOSE, android.service.controls.DeviceTypes#TYPE_GENERIC_LOCK_UNLOCK, android.service.controls.DeviceTypes#TYPE_GENERIC_ARM_DISARM, android.service.controls.DeviceTypes#TYPE_GENERIC_TEMP_SETTING, android.service.controls.DeviceTypes#TYPE_GENERIC_VIEWSTREAM, android.service.controls.DeviceTypes#TYPE_UNKNOWN, android.service.controls.DeviceTypes#TYPE_AC_HEATER, android.service.controls.DeviceTypes#TYPE_AC_UNIT, android.service.controls.DeviceTypes#TYPE_AIR_FRESHENER, android.service.controls.DeviceTypes#TYPE_AIR_PURIFIER, android.service.controls.DeviceTypes#TYPE_COFFEE_MAKER, android.service.controls.DeviceTypes#TYPE_DEHUMIDIFIER, android.service.controls.DeviceTypes#TYPE_DISPLAY, android.service.controls.DeviceTypes#TYPE_FAN, android.service.controls.DeviceTypes#TYPE_HOOD, android.service.controls.DeviceTypes#TYPE_HUMIDIFIER, android.service.controls.DeviceTypes#TYPE_KETTLE, android.service.controls.DeviceTypes#TYPE_LIGHT, android.service.controls.DeviceTypes#TYPE_MICROWAVE, android.service.controls.DeviceTypes#TYPE_OUTLET, android.service.controls.DeviceTypes#TYPE_RADIATOR, android.service.controls.DeviceTypes#TYPE_REMOTE_CONTROL, android.service.controls.DeviceTypes#TYPE_SET_TOP, android.service.controls.DeviceTypes#TYPE_STANDMIXER, android.service.controls.DeviceTypes#TYPE_STYLER, android.service.controls.DeviceTypes#TYPE_SWITCH, android.service.controls.DeviceTypes#TYPE_TV, android.service.controls.DeviceTypes#TYPE_WATER_HEATER, android.service.controls.DeviceTypes#TYPE_DISHWASHER, android.service.controls.DeviceTypes#TYPE_DRYER, android.service.controls.DeviceTypes#TYPE_MOP, android.service.controls.DeviceTypes#TYPE_MOWER, android.service.controls.DeviceTypes#TYPE_MULTICOOKER, android.service.controls.DeviceTypes#TYPE_SHOWER, android.service.controls.DeviceTypes#TYPE_SPRINKLER, android.service.controls.DeviceTypes#TYPE_WASHER, android.service.controls.DeviceTypes#TYPE_VACUUM, android.service.controls.DeviceTypes#TYPE_AWNING, android.service.controls.DeviceTypes#TYPE_BLINDS, android.service.controls.DeviceTypes#TYPE_CLOSET, android.service.controls.DeviceTypes#TYPE_CURTAIN, android.service.controls.DeviceTypes#TYPE_DOOR, android.service.controls.DeviceTypes#TYPE_DRAWER, android.service.controls.DeviceTypes#TYPE_GARAGE, android.service.controls.DeviceTypes#TYPE_GATE, android.service.controls.DeviceTypes#TYPE_PERGOLA, android.service.controls.DeviceTypes#TYPE_SHUTTER, android.service.controls.DeviceTypes#TYPE_WINDOW, android.service.controls.DeviceTypes#TYPE_VALVE, android.service.controls.DeviceTypes#TYPE_LOCK, android.service.controls.DeviceTypes#TYPE_SECURITY_SYSTEM, android.service.controls.DeviceTypes#TYPE_HEATER, android.service.controls.DeviceTypes#TYPE_REFRIGERATOR, android.service.controls.DeviceTypes#TYPE_THERMOSTAT, android.service.controls.DeviceTypes#TYPE_CAMERA, android.service.controls.DeviceTypes#TYPE_DOORBELL, or android.service.controls.DeviceTypes#TYPE_ROUTINE
Return
Control.StatelessBuilder this This value cannot be null.

setStructure

Added in API level 30
fun setStructure(structure: CharSequence?): Control.StatelessBuilder

Optional top-level group to help define the Control's location, visible to the user. If not present, the application name will be used as the top-level group. A structure contains zones which contains controls.

Parameters
structure CharSequence?: name of the structure containing the control This value may be null.
Return
Control.StatelessBuilder this This value cannot be null.

setSubtitle

Added in API level 30
fun setSubtitle(subtitle: CharSequence): Control.StatelessBuilder
Parameters
subtitle CharSequence: additional information about the Control, to appear underneath the title This value cannot be null.
Return
Control.StatelessBuilder this This value cannot be null.

setTitle

Added in API level 30
fun setTitle(title: CharSequence): Control.StatelessBuilder
Parameters
title CharSequence: the user facing name of the Control This value cannot be null.
Return
Control.StatelessBuilder this This value cannot be null.

setZone

Added in API level 30
fun setZone(zone: CharSequence?): Control.StatelessBuilder

Optional group name to help define the Control's location within a structure, visible to the user. A structure contains zones which contains controls.

Parameters
zone CharSequence?: name of the zone containing the control This value may be null.
Return
Control.StatelessBuilder this This value cannot be null.