Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/service/controls/actions/ControlAction#constants) \| [Methods](https://developer.android.com/reference/android/service/controls/actions/ControlAction#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/service/controls/actions/ControlAction#inhmethods)

# ControlAction

*** ** * ** ***

` public abstract class ControlAction `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.service.controls.actions.ControlAction |

Known direct subclasses [BooleanAction](https://developer.android.com/reference/android/service/controls/actions/BooleanAction), [CommandAction](https://developer.android.com/reference/android/service/controls/actions/CommandAction), [FloatAction](https://developer.android.com/reference/android/service/controls/actions/FloatAction), [ModeAction](https://developer.android.com/reference/android/service/controls/actions/ModeAction) [BooleanAction](https://developer.android.com/reference/android/service/controls/actions/BooleanAction) Action sent by user toggling a `https://developer.android.com/reference/android/service/controls/Control` between checked/unchecked. [CommandAction](https://developer.android.com/reference/android/service/controls/actions/CommandAction) A simple `https://developer.android.com/reference/android/service/controls/actions/ControlAction` indicating that the user has interacted with a `https://developer.android.com/reference/android/service/controls/Control` created using a `https://developer.android.com/reference/android/service/controls/templates/StatelessTemplate`. [FloatAction](https://developer.android.com/reference/android/service/controls/actions/FloatAction) Action sent by a `https://developer.android.com/reference/android/service/controls/templates/RangeTemplate`, `https://developer.android.com/reference/android/service/controls/templates/ToggleRangeTemplate`. [ModeAction](https://developer.android.com/reference/android/service/controls/actions/ModeAction) Action sent by the user to indicate a change of mode.   

*** ** * ** ***

An abstract action indicating a user interaction with a `https://developer.android.com/reference/android/service/controls/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 `https://developer.android.com/reference/android/service/controls/actions/ControlAction` only if the service has responded to an action with one of:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE`

<br />

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK` Response code for the `consumer` in `https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>)` indicating that in order for the action to be performed, acknowledgment from the user is required. |
| `int` | `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE` Response code for the `consumer` in `https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>)` indicating that in order for the action to be performed, an alphanumeric passphrase is required. |
| `int` | `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN` Response code for the `consumer` in `https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>)` indicating that in order for the action to be performed, a PIN is required. |
| `int` | `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_FAIL` Response code for the `consumer` in `https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>)` indicating that the action has failed. |
| `int` | `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_OK` Response code for the `consumer` in `https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>)` indicating that the action has been performed. |
| `int` | `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_UNKNOWN` Value is one of the following: - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_UNKNOWN` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_OK` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_FAIL` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE` |
| `int` | `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_BOOLEAN` The identifier of `https://developer.android.com/reference/android/service/controls/actions/BooleanAction`. |
| `int` | `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_COMMAND` The identifier of `https://developer.android.com/reference/android/service/controls/actions/CommandAction`. |
| `int` | `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_ERROR` The identifier of the action returned by `https://developer.android.com/reference/android/service/controls/actions/ControlAction#getErrorAction()`. |
| `int` | `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_FLOAT` The identifier of `https://developer.android.com/reference/android/service/controls/actions/FloatAction`. |
| `int` | `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_MODE` The identifier of `https://developer.android.com/reference/android/service/controls/actions/ModeAction`. |

| ### Public methods ||
|---|---|
| ` abstract int` | ` https://developer.android.com/reference/android/service/controls/actions/ControlAction#getActionType()() ` The action type associated with this class. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/service/controls/actions/ControlAction#getChallengeValue()() ` The challenge value used to authenticate certain actions, if available. |
| ` static https://developer.android.com/reference/android/service/controls/actions/ControlAction` | ` https://developer.android.com/reference/android/service/controls/actions/ControlAction#getErrorAction()() ` Returns a singleton `https://developer.android.com/reference/android/service/controls/actions/ControlAction` used for indicating an error in unparceling. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/service/controls/actions/ControlAction#getTemplateId()() ` The identifier of the `https://developer.android.com/reference/android/service/controls/templates/ControlTemplate` that originated this action |
| ` static final boolean` | ` https://developer.android.com/reference/android/service/controls/actions/ControlAction#isValidResponse(int)(int response) ` |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### RESPONSE_CHALLENGE_ACK

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int RESPONSE_CHALLENGE_ACK
```

Response code for the `consumer` in `https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>)` indicating that in order for the action to be performed, acknowledgment from the user is required. Any non-empty string returned from `https://developer.android.com/reference/android/service/controls/actions/ControlAction#getChallengeValue()` shall be treated as a positive acknowledgment.   

Value is one of the following:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_UNKNOWN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_OK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_FAIL`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE`
  - Constant Value: 3 (0x00000003)

### RESPONSE_CHALLENGE_PASSPHRASE

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int RESPONSE_CHALLENGE_PASSPHRASE
```

Response code for the `consumer` in `https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>)` indicating that in order for the action to be performed, an alphanumeric passphrase is required.   

Value is one of the following:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_UNKNOWN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_OK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_FAIL`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE`
  - Constant Value: 5 (0x00000005)

### RESPONSE_CHALLENGE_PIN

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int RESPONSE_CHALLENGE_PIN
```

Response code for the `consumer` in `https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>)` indicating that in order for the action to be performed, a PIN is required.   

Value is one of the following:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_UNKNOWN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_OK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_FAIL`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE`
  - Constant Value: 4 (0x00000004)

### RESPONSE_FAIL

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int RESPONSE_FAIL
```

Response code for the `consumer` in `https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>)` indicating that the action has failed.   

Value is one of the following:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_UNKNOWN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_OK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_FAIL`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE`
  - Constant Value: 2 (0x00000002)

### RESPONSE_OK

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int RESPONSE_OK
```

Response code for the `consumer` in `https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>)` indicating that the action has been performed. The action may still fail later and the state may not change.   

Value is one of the following:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_UNKNOWN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_OK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_FAIL`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE`
  - Constant Value: 1 (0x00000001)

### RESPONSE_UNKNOWN

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int RESPONSE_UNKNOWN
```

Value is one of the following:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_UNKNOWN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_OK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_FAIL`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE`
  - Constant Value: 0 (0x00000000)

### TYPE_BOOLEAN

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TYPE_BOOLEAN
```

The identifier of `https://developer.android.com/reference/android/service/controls/actions/BooleanAction`.   

Value is one of the following:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_ERROR`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_BOOLEAN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_FLOAT`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_MODE`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_COMMAND`
  - Constant Value: 1 (0x00000001)

### TYPE_COMMAND

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TYPE_COMMAND
```

The identifier of `https://developer.android.com/reference/android/service/controls/actions/CommandAction`.   

Value is one of the following:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_ERROR`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_BOOLEAN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_FLOAT`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_MODE`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_COMMAND`
  - Constant Value: 5 (0x00000005)

### TYPE_ERROR

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TYPE_ERROR
```

The identifier of the action returned by `https://developer.android.com/reference/android/service/controls/actions/ControlAction#getErrorAction()`.   

Value is one of the following:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_ERROR`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_BOOLEAN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_FLOAT`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_MODE`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_COMMAND`
  - Constant Value: -1 (0xffffffff)

### TYPE_FLOAT

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TYPE_FLOAT
```

The identifier of `https://developer.android.com/reference/android/service/controls/actions/FloatAction`.   

Value is one of the following:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_ERROR`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_BOOLEAN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_FLOAT`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_MODE`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_COMMAND`
  - Constant Value: 2 (0x00000002)

### TYPE_MODE

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TYPE_MODE
```

The identifier of `https://developer.android.com/reference/android/service/controls/actions/ModeAction`.   

Value is one of the following:

- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_ERROR`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_BOOLEAN`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_FLOAT`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_MODE`
- `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_COMMAND`
  - Constant Value: 4 (0x00000004)

## Public methods

### getActionType

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract int getActionType ()
```

The action type associated with this class.

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_ERROR` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_BOOLEAN` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_FLOAT` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_MODE` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_COMMAND` |

### getChallengeValue

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getChallengeValue ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | This value may be `null`. <br /> |

### getErrorAction

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ControlAction getErrorAction ()
```

Returns a singleton `https://developer.android.com/reference/android/service/controls/actions/ControlAction` used for indicating an error in unparceling.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/controls/actions/ControlAction` | This value cannot be `null`. <br /> |

### getTemplateId

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getTemplateId ()
```

The identifier of the `https://developer.android.com/reference/android/service/controls/templates/ControlTemplate` that originated this action

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | This value cannot be `null`. <br /> |

### isValidResponse

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final boolean isValidResponse (int response)
```

<br />

<br />

| Parameters ||
|---|---|
| `response` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_UNKNOWN` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_OK` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_FAIL` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN` - `https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE` |

| Returns ||
|---|---|
| `boolean` | <br /> |