ControlAction


public abstract class ControlAction
extends Object

java.lang.Object
   ↳ android.service.controls.actions.ControlAction


An abstract action indicating a user interaction with a Control. In some cases, an action needs to be validated by the user, using a password, PIN or simple acknowledgment. For those cases, an optional (nullable) parameter can be passed to send the user input. This challenge value will be requested from the user and sent as part of a ControlAction only if the service has responded to an action with one of:

Summary

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.

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.

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.

int RESPONSE_FAIL

Response code for the consumer in ControlsProviderService.performControlAction indicating that the action has failed.

int RESPONSE_OK

Response code for the consumer in ControlsProviderService.performControlAction indicating that the action has been performed.

int RESPONSE_UNKNOWN

Value is RESPONSE_UNKNOWN, RESPONSE_OK, RESPONSE_FAIL, RESPONSE_CHALLENGE_ACK, RESPONSE_CHALLENGE_PIN, or RESPONSE_CHALLENGE_PASSPHRASE

int TYPE_BOOLEAN

The identifier of BooleanAction.

int TYPE_COMMAND

The identifier of CommandAction.

int TYPE_ERROR

The identifier of the action returned by getErrorAction().

int TYPE_FLOAT

The identifier of FloatAction.

int TYPE_MODE

The identifier of ModeAction.

Public methods

abstract int getActionType()

The action type associated with this class.

String getChallengeValue()

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

static ControlAction getErrorAction()

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

String getTemplateId()

The identifier of the ControlTemplate that originated this action

static final boolean isValidResponse(int response)

Inherited methods

Constants

RESPONSE_CHALLENGE_ACK

Added in API level 30
public static final 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 RESPONSE_UNKNOWN, RESPONSE_OK, RESPONSE_FAIL, RESPONSE_CHALLENGE_ACK, RESPONSE_CHALLENGE_PIN, or RESPONSE_CHALLENGE_PASSPHRASE

Constant Value: 3 (0x00000003)

RESPONSE_CHALLENGE_PASSPHRASE

Added in API level 30
public static final 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 RESPONSE_UNKNOWN, RESPONSE_OK, RESPONSE_FAIL, RESPONSE_CHALLENGE_ACK, RESPONSE_CHALLENGE_PIN, or RESPONSE_CHALLENGE_PASSPHRASE

Constant Value: 5 (0x00000005)

RESPONSE_CHALLENGE_PIN

Added in API level 30
public static final 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 RESPONSE_UNKNOWN, RESPONSE_OK, RESPONSE_FAIL, RESPONSE_CHALLENGE_ACK, RESPONSE_CHALLENGE_PIN, or RESPONSE_CHALLENGE_PASSPHRASE

Constant Value: 4 (0x00000004)

RESPONSE_FAIL

Added in API level 30
public static final int RESPONSE_FAIL

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

Constant Value: 2 (0x00000002)

RESPONSE_OK

Added in API level 30
public static final 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 RESPONSE_UNKNOWN, RESPONSE_OK, RESPONSE_FAIL, RESPONSE_CHALLENGE_ACK, RESPONSE_CHALLENGE_PIN, or RESPONSE_CHALLENGE_PASSPHRASE

Constant Value: 1 (0x00000001)

RESPONSE_UNKNOWN

Added in API level 30
public static final int RESPONSE_UNKNOWN

Value is RESPONSE_UNKNOWN, RESPONSE_OK, RESPONSE_FAIL, RESPONSE_CHALLENGE_ACK, RESPONSE_CHALLENGE_PIN, or RESPONSE_CHALLENGE_PASSPHRASE

Constant Value: 0 (0x00000000)

TYPE_BOOLEAN

Added in API level 30
public static final int TYPE_BOOLEAN

The identifier of BooleanAction.
Value is TYPE_ERROR, TYPE_BOOLEAN, TYPE_FLOAT, TYPE_MODE, or TYPE_COMMAND

Constant Value: 1 (0x00000001)

TYPE_COMMAND

Added in API level 30
public static final int TYPE_COMMAND

The identifier of CommandAction.
Value is TYPE_ERROR, TYPE_BOOLEAN, TYPE_FLOAT, TYPE_MODE, or TYPE_COMMAND

Constant Value: 5 (0x00000005)

TYPE_ERROR

Added in API level 30
public static final int TYPE_ERROR

The identifier of the action returned by getErrorAction().
Value is TYPE_ERROR, TYPE_BOOLEAN, TYPE_FLOAT, TYPE_MODE, or TYPE_COMMAND

Constant Value: -1 (0xffffffff)

TYPE_FLOAT

Added in API level 30
public static final int TYPE_FLOAT

The identifier of FloatAction.
Value is TYPE_ERROR, TYPE_BOOLEAN, TYPE_FLOAT, TYPE_MODE, or TYPE_COMMAND

Constant Value: 2 (0x00000002)

TYPE_MODE

Added in API level 30
public static final int TYPE_MODE

The identifier of ModeAction.
Value is TYPE_ERROR, TYPE_BOOLEAN, TYPE_FLOAT, TYPE_MODE, or TYPE_COMMAND

Constant Value: 4 (0x00000004)

Public methods

getActionType

Added in API level 30
public abstract int getActionType ()

The action type associated with this class.

Returns
int Value is TYPE_ERROR, TYPE_BOOLEAN, TYPE_FLOAT, TYPE_MODE, or TYPE_COMMAND

getChallengeValue

Added in API level 30
public String getChallengeValue ()

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

Returns
String This value may be null.

getErrorAction

Added in API level 30
public static ControlAction getErrorAction ()

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

Returns
ControlAction This value cannot be null.

getTemplateId

Added in API level 30
public String getTemplateId ()

The identifier of the ControlTemplate that originated this action

Returns
String This value cannot be null.

isValidResponse

Added in API level 30
public static final boolean isValidResponse (int response)

Parameters
response int: Value is RESPONSE_UNKNOWN, RESPONSE_OK, RESPONSE_FAIL, RESPONSE_CHALLENGE_ACK, RESPONSE_CHALLENGE_PIN, or RESPONSE_CHALLENGE_PASSPHRASE

Returns
boolean