Added in API level 30

BooleanAction


class BooleanAction : ControlAction

Action sent by user toggling a Control between checked/unchecked. This action is available when the Control was constructed with either a ToggleTemplate or a ToggleRangeTemplate.

Summary

Inherited constants
Int RESPONSE_CHALLENGE_ACK

Response code for the consumer in ControlsProviderService.performControlAction indicating that in order for the action to be performed, acknowledgment from the user is required. Any non-empty string returned from getChallengeValue shall be treated as a positive acknowledgment.
Value is android.service.controls.actions.ControlAction#RESPONSE_UNKNOWN, android.service.controls.actions.ControlAction#RESPONSE_OK, android.service.controls.actions.ControlAction#RESPONSE_FAIL, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_ACK, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PIN, or android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PASSPHRASE

Int RESPONSE_CHALLENGE_PASSPHRASE

Response code for the consumer in ControlsProviderService.performControlAction indicating that in order for the action to be performed, an alphanumeric passphrase is required.
Value is android.service.controls.actions.ControlAction#RESPONSE_UNKNOWN, android.service.controls.actions.ControlAction#RESPONSE_OK, android.service.controls.actions.ControlAction#RESPONSE_FAIL, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_ACK, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PIN, or android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PASSPHRASE

Int RESPONSE_CHALLENGE_PIN

Response code for the consumer in ControlsProviderService.performControlAction indicating that in order for the action to be performed, a PIN is required.
Value is android.service.controls.actions.ControlAction#RESPONSE_UNKNOWN, android.service.controls.actions.ControlAction#RESPONSE_OK, android.service.controls.actions.ControlAction#RESPONSE_FAIL, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_ACK, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PIN, or android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PASSPHRASE

Int RESPONSE_FAIL

Response code for the consumer in ControlsProviderService.performControlAction indicating that the action has failed.
Value is android.service.controls.actions.ControlAction#RESPONSE_UNKNOWN, android.service.controls.actions.ControlAction#RESPONSE_OK, android.service.controls.actions.ControlAction#RESPONSE_FAIL, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_ACK, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PIN, or android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PASSPHRASE

Int RESPONSE_OK

Response code for the consumer in ControlsProviderService.performControlAction indicating that the action has been performed. The action may still fail later and the state may not change.
Value is android.service.controls.actions.ControlAction#RESPONSE_UNKNOWN, android.service.controls.actions.ControlAction#RESPONSE_OK, android.service.controls.actions.ControlAction#RESPONSE_FAIL, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_ACK, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PIN, or android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PASSPHRASE

Int RESPONSE_UNKNOWN

Value is android.service.controls.actions.ControlAction#RESPONSE_UNKNOWN, android.service.controls.actions.ControlAction#RESPONSE_OK, android.service.controls.actions.ControlAction#RESPONSE_FAIL, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_ACK, android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PIN, or android.service.controls.actions.ControlAction#RESPONSE_CHALLENGE_PASSPHRASE

Int TYPE_BOOLEAN

The identifier of BooleanAction.
Value is android.service.controls.actions.ControlAction#TYPE_ERROR, android.service.controls.actions.ControlAction#TYPE_BOOLEAN, android.service.controls.actions.ControlAction#TYPE_FLOAT, android.service.controls.actions.ControlAction#TYPE_MODE, or android.service.controls.actions.ControlAction#TYPE_COMMAND

Int TYPE_COMMAND

The identifier of CommandAction.
Value is android.service.controls.actions.ControlAction#TYPE_ERROR, android.service.controls.actions.ControlAction#TYPE_BOOLEAN, android.service.controls.actions.ControlAction#TYPE_FLOAT, android.service.controls.actions.ControlAction#TYPE_MODE, or android.service.controls.actions.ControlAction#TYPE_COMMAND

Int TYPE_ERROR

The identifier of the action returned by getErrorAction.
Value is android.service.controls.actions.ControlAction#TYPE_ERROR, android.service.controls.actions.ControlAction#TYPE_BOOLEAN, android.service.controls.actions.ControlAction#TYPE_FLOAT, android.service.controls.actions.ControlAction#TYPE_MODE, or android.service.controls.actions.ControlAction#TYPE_COMMAND

Int TYPE_FLOAT

The identifier of FloatAction.
Value is android.service.controls.actions.ControlAction#TYPE_ERROR, android.service.controls.actions.ControlAction#TYPE_BOOLEAN, android.service.controls.actions.ControlAction#TYPE_FLOAT, android.service.controls.actions.ControlAction#TYPE_MODE, or android.service.controls.actions.ControlAction#TYPE_COMMAND

Int TYPE_MODE

The identifier of ModeAction.
Value is android.service.controls.actions.ControlAction#TYPE_ERROR, android.service.controls.actions.ControlAction#TYPE_BOOLEAN, android.service.controls.actions.ControlAction#TYPE_FLOAT, android.service.controls.actions.ControlAction#TYPE_MODE, or android.service.controls.actions.ControlAction#TYPE_COMMAND

Public constructors
BooleanAction(templateId: String, newState: Boolean)

BooleanAction(templateId: String, newState: Boolean, challengeValue: String?)

Public methods
Int

Boolean

The new state set for the button in the corresponding ToggleTemplate.

Inherited functions
String? getChallengeValue()

The challenge value used to authenticate certain actions, if available.

ControlAction getErrorAction()

Returns a singleton ControlAction used for indicating an error in unparceling.

String getTemplateId()

The identifier of the ControlTemplate that originated this action

Boolean isValidResponse(response: Int)

Public constructors

BooleanAction

Added in API level 30
BooleanAction(
    templateId: String,
    newState: Boolean)
Parameters
templateId String: the identifier of the ToggleTemplate that produced this action. This value cannot be null.
newState Boolean: new value for the state displayed by the ToggleTemplate.

BooleanAction

Added in API level 30
BooleanAction(
    templateId: String,
    newState: Boolean,
    challengeValue: String?)
Parameters
templateId String: the identifier of the template that originated this action. This value cannot be null.
newState Boolean: new value for the state displayed by the template.
challengeValue String?: a value sent by the user along with the action to authenticate. null is sent when no authentication is needed or has not been requested.

Public methods

getActionType

Added in API level 30
fun getActionType(): Int

getNewState

Added in API level 30
fun getNewState(): Boolean

The new state set for the button in the corresponding ToggleTemplate.

Return
Boolean true if the button was toggled from unchecked to checked.