# A2uiActionInterceptor

Artifact: [androidx.a2ui:a2ui-model](https://developer.android.com/jetpack/androidx/releases/a2ui) [View Source](https://cs.android.com/search?q=file:androidx/a2ui/model/processor/A2uiActionInterceptor.kt+class:androidx.a2ui.model.processor.A2uiActionInterceptor) Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui#1.0.0-alpha02)

*** ** * ** ***


```
fun interface A2uiActionInterceptor
```

<br />

*** ** * ** ***

Intercepts, transforms, or drops `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiUserAction`s before they are processed by the core layer.

This acts as a middleware pipeline. Multiple interceptors can be registered. The output of one interceptor is passed as the input to the next in the chain. The order of registration dictates the order of execution. It can process both local function actions and server event actions.

## Summary

| ### Public functions |
|---|---|
| `suspend https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiUserAction?` | `https://developer.android.com/reference/kotlin/androidx/a2ui/model/processor/A2uiActionInterceptor#onInterceptAction(androidx.a2ui.model.protocol.A2uiUserAction)(action: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiUserAction)` Called before a user action is handled by the core layer. |

## Public functions

### onInterceptAction

```
suspend fun onInterceptAction(action: A2uiUserAction): A2uiUserAction?
```

Called before a user action is handled by the core layer.

Note: This method blocks the processing pipeline for the surface. Implementations should be lightweight.

| Parameters |
|---|---|
| `action: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiUserAction` | the incoming user action details. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiUserAction?` | The original action, a transformed/modified action to pass to the next interceptor, or `null` to consume the action entirely and stop further processing. |