# IntentSanitizer.Builder

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/content/IntentSanitizer.java+class:androidx.core.content.IntentSanitizer.Builder) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

*** ** * ** ***

<br />

```
public final class IntentSanitizer.Builder
```

<br />

*** ** * ** ***

General strategy of building is to only offer additive "or" operations that are chained together. Any more complex operations can be performed by the developer providing their own custom Predicate.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#Builder()()` |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowAction(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html action)` Add an action to the list of allowed actions. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowAction(androidx.core.util.Predicate<java.lang.String>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/java/lang/String.html> filter)` Add a filter for allowed actions. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowAnyComponent()()` Allow any components. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowCategory(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html category)` Add a category to the allowed category list. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowCategory(androidx.core.util.Predicate<java.lang.String>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/java/lang/String.html> filter)` Add a filter for allowed categories. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowClipData(androidx.core.util.Predicate<android.content.ClipData>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/content/ClipData.html> filter)` Allows clipData that passes the given filter. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowClipDataText()()` Allows clipData that contains text. overwrite each other. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowClipDataUri(androidx.core.util.Predicate<android.net.Uri>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/net/Uri.html> filter)` Allows clipData whose items URIs pass the given URI filter. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowClipDataUriWithAuthority(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html authority)` Allows clipData whose items URIs authorities match the given authority. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowComponent(android.content.ComponentName)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/ComponentName.html component)` Add a component to the allowed components list. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowComponent(androidx.core.util.Predicate<android.content.ComponentName>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/content/ComponentName.html> filter)` Add a filter for allowed components. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowComponentWithPackage(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName)` Allow any component under the specified package. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowData(androidx.core.util.Predicate<android.net.Uri>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/net/Uri.html> filter)` Allow data that passes the filter test. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowDataWithAuthority(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html authority)` Convenient method to allow all data whose URI authority equals to the given. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowExtra(java.lang.String,java.lang.Class<?>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html key, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> clazz)` Allows an extra member whose key and type of value matches the given. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowExtra(java.lang.String,androidx.core.util.Predicate<java.lang.Object>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html key, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/java/lang/Object.html> filter)` Allows an extra member whose key matches the given key and whose value passes the filter test. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `<T> https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowExtra(java.lang.String,java.lang.Class<T>,androidx.core.util.Predicate<T>)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html key, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Class.html<T> clazz, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<T> valueFilter )` Allows an extra member whose key matches the given key and whose value is of the type of the given clazz and passes the value filter. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowExtraOutput(androidx.core.util.Predicate<android.net.Uri>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/net/Uri.html> filter)` Allows an extra member with the key MediaStore.EXTRA_OUTPUT. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowExtraOutput(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html uriAuthority)` Allows an extra member with the key MediaStore.EXTRA_OUTPUT. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowExtraStream(androidx.core.util.Predicate<android.net.Uri>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/net/Uri.html> filter)` Allows an extra member with the key Intent.EXTRA_STREAM. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowExtraStreamUriWithAuthority(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html uriAuthority)` Allows an extra member with the key Intent.EXTRA_STREAM. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowFlags(int)(int flags)` Sets allowed flags. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowHistoryStackFlags()()` Adds all history stack flags into the allowed flags set. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowIdentifier()()` Allows any identifier. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowPackage(androidx.core.util.Predicate<java.lang.String>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/java/lang/String.html> filter)` Add a filter for allowed packages. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowPackage(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName)` Add a package to the allowed packages. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowReceiverFlags()()` Adds all receiver flags into the allowed flags set. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowSelector()()` Allow any selector. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowSourceBounds()()` Allow any source bounds. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowType(androidx.core.util.Predicate<java.lang.String>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/java/lang/String.html> filter)` Add a filter for allowed data types. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowType(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html type)` Add a data type to the allowed type list. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer` | `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#build()()` Build the IntentSanitizer. |

## Public constructors

### Builder

Added in 1.9.0

```
public Builder()
```

## Public methods

### allowAction

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowAction(@NonNull String action)
```

Add an action to the list of allowed actions. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html action` | the name of an action. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowAction

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowAction(@NonNull Predicate<String> filter)
```

Add a filter for allowed actions. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/java/lang/String.html> filter` | a filter that tests if an action is allowed. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowAnyComponent

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowAnyComponent()
```

Allow any components. Be cautious to call this method. When this method is called, you should definitely disallow the 4 grant URI permission flags. This method is useful in case the redirected intent is designed to support implicit intent. This method is made mutually exclusive to the 4 methods that allow components or packages.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowCategory

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowCategory(@NonNull String category)
```

Add a category to the allowed category list. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html category` | the allowed category. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowCategory

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowCategory(@NonNull Predicate<String> filter)
```

Add a filter for allowed categories. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/java/lang/String.html> filter` | the category filter. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowClipData

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowClipData(@NonNull Predicate<ClipData> filter)
```

Allows clipData that passes the given filter. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/content/ClipData.html> filter` | the given clipData filter. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowClipDataText

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowClipDataText()
```

Allows clipData that contains text. overwrite each other.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowClipDataUri

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowClipDataUri(@NonNull Predicate<Uri> filter)
```

Allows clipData whose items URIs pass the given URI filter. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/net/Uri.html> filter` | the given URI filter. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowClipDataUriWithAuthority

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowClipDataUriWithAuthority(@NonNull String authority)
```

Allows clipData whose items URIs authorities match the given authority. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html authority` | the given authority. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowComponent

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowComponent(@NonNull ComponentName component)
```

Add a component to the allowed components list. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/ComponentName.html component` | the allowed component. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowComponent

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowComponent(@NonNull Predicate<ComponentName> filter)
```

Add a filter for allowed components. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/content/ComponentName.html> filter` | the component filter. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowComponentWithPackage

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowComponentWithPackage(@NonNull String packageName)
```

Allow any component under the specified package. Note this does not allow the package itself. If the intent contains a package, call allowPackage method. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowData

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowData(@NonNull Predicate<Uri> filter)
```

Allow data that passes the filter test. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/net/Uri.html> filter` | data filter. |

### allowDataWithAuthority

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowDataWithAuthority(@NonNull String authority)
```

Convenient method to allow all data whose URI authority equals to the given. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html authority` | the URI's authority. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder |

### allowExtra

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowExtra(@NonNull String key, @NonNull Class<@NonNull ?> clazz)
```

Allows an extra member whose key and type of value matches the given. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html key` | the given extra key. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> clazz` | the given class of the extra value. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowExtra

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowExtra(@NonNull String key, @NonNull Predicate<Object> filter)
```

Allows an extra member whose key matches the given key and whose value passes the filter test. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html key` | the extra key. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/java/lang/Object.html> filter` | the filter for the extra value. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowExtra

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder <T> allowExtra(
    @NonNull String key,
    @NonNull Class<T> clazz,
    @NonNull Predicate<T> valueFilter
)
```

Allows an extra member whose key matches the given key and whose value is of the type of the given clazz and passes the value filter. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html key` | given extra key. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Class.html<T> clazz` | given type of the extra value. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<T> valueFilter` | the extra value filter. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowExtraOutput

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowExtraOutput(@NonNull Predicate<Uri> filter)
```

Allows an extra member with the key MediaStore.EXTRA_OUTPUT. The value type has to be URI and the value also passes the given filter test. In order to use this method, user has to be explicitly allow the `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION` and `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_WRITE_URI_PERMISSION` flags. Otherwise, it will trigger penalty during sanitization. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/net/Uri.html> filter` | the given URI authority. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowExtraOutput

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowExtraOutput(@NonNull String uriAuthority)
```

Allows an extra member with the key MediaStore.EXTRA_OUTPUT. The value type has to be URI and the authority matches the given parameter. In order to use this method, user has to be explicitly allow the `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION` and `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_WRITE_URI_PERMISSION` flags. Otherwise, it will trigger penalty during sanitization. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html uriAuthority` | the given URI authority. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowExtraStream

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowExtraStream(@NonNull Predicate<Uri> filter)
```

Allows an extra member with the key Intent.EXTRA_STREAM. The value type has to be URI and the value also passes the given filter test. In order to use this method, user has to be explicitly allow the `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION` flag. Otherwise, it will trigger penalty during sanitization. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/android/net/Uri.html> filter` | the given URI authority. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowExtraStreamUriWithAuthority

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowExtraStreamUriWithAuthority(@NonNull String uriAuthority)
```

Allows an extra member with the key Intent.EXTRA_STREAM. The value type has to be URI and the authority matches the given parameter. In order to use this method, user has to be explicitly allow the `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION` flag. Otherwise, it will trigger penalty during sanitization. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html uriAuthority` | the given URI authority. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowFlags

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowFlags(int flags)
```

Sets allowed flags. This method can be called multiple times and the result is additive. They will not overwrite each other. In most cases following grant URI permission related flags should **not** be allowed:

- FLAG_GRANT_PERSISTABLE_URI_PERMISSION
- FLAG_GRANT_PREFIX_URI_PERMISSION
- FLAG_GRANT_READ_URI_PERMISSION
- FLAG_GRANT_WRITE_URI_PERMISSION

Setting these flags would allow others to access URIs only your app has permission to access. These URIs could be set in intent's data, clipData and/or, in certain circumstances, extras with key of `https://developer.android.com/reference/android/content/Intent.html#EXTRA_STREAM` or `https://developer.android.com/reference/android/provider/MediaStore.html#EXTRA_OUTPUT`. When these flags are allowed, you should sanitize URIs. See `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowDataWithAuthority(java.lang.String)`, `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowData(androidx.core.util.Predicate<android.net.Uri>)`, `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowClipDataUriWithAuthority(java.lang.String)`, `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowClipDataUri(androidx.core.util.Predicate<android.net.Uri>)`, `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowExtraStreamUriWithAuthority(java.lang.String)`, `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowExtraStream(androidx.core.util.Predicate<android.net.Uri>)`, `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowExtraOutput(java.lang.String)`, `https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder#allowExtraOutput(androidx.core.util.Predicate<android.net.Uri>)`

| Parameters |
|---|---|
| `int flags` | allowed flags. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowHistoryStackFlags

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowHistoryStackFlags()
```

Adds all history stack flags into the allowed flags set. They are:

- FLAG_ACTIVITY_BROUGHT_TO_FRONT
- FLAG_ACTIVITY_CLEAR_TASK
- FLAG_ACTIVITY_CLEAR_TOP
- FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
- FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
- FLAG_ACTIVITY_LAUNCH_ADJACENT
- FLAG_ACTIVITY_MULTIPLE_TASK
- FLAG_ACTIVITY_NEW_DOCUMENT
- FLAG_ACTIVITY_NEW_TASK
- FLAG_ACTIVITY_NO_ANIMATION
- FLAG_ACTIVITY_NO_HISTORY
- FLAG_ACTIVITY_PREVIOUS_IS_TOP
- FLAG_ACTIVITY_REORDER_TO_FRONT
- FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
- FLAG_ACTIVITY_RETAIN_IN_RECENTS
- FLAG_ACTIVITY_SINGLE_TOP
- FLAG_ACTIVITY_TASK_ON_HOME

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowIdentifier

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowIdentifier()
```

Allows any identifier.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowPackage

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowPackage(@NonNull Predicate<String> filter)
```

Add a filter for allowed packages. This does not imply the intent can contain a component from the allowed package; instead, this value will be compared against the result returned from the Intent's `https://developer.android.com/reference/android/content/Intent.html#getPackage()` method. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/java/lang/String.html> filter` | the package name filter. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowPackage

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowPackage(@NonNull String packageName)
```

Add a package to the allowed packages. This does not imply the intent can contain a component from the allowed package; instead, this value will be compared against the result returned from the Intent's `https://developer.android.com/reference/android/content/Intent.html#getPackage()` method. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowReceiverFlags

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowReceiverFlags()
```

Adds all receiver flags into the allowed flags set. They are

- FLAG_RECEIVER_FOREGROUND
- FLAG_RECEIVER_NO_ABORT
- FLAG_RECEIVER_REGISTERED_ONLY
- FLAG_RECEIVER_REPLACE_PENDING
- FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowSelector

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowSelector()
```

Allow any selector.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowSourceBounds

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowSourceBounds()
```

Allow any source bounds.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder. |

### allowType

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowType(@NonNull Predicate<String> filter)
```

Add a filter for allowed data types. This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Predicate<https://developer.android.com/reference/java/lang/String.html> filter` | the data type filter. |

### allowType

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer.Builder allowType(@NonNull String type)
```

Add a data type to the allowed type list. Exact match is used to check the allowed types. For example, if you pass in "image/\*" here, it won't allow an intent with type of "image/png". This method can be called multiple times and the result is additive. They will not overwrite each other.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html type` | the data type that is allowed |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer.Builder` | this builder |

### build

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)

```
public @NonNull IntentSanitizer build()
```

Build the IntentSanitizer.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/content/IntentSanitizer` | the IntentSanitizer |