Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions) Summary: [Constants](https://developer.android.com/reference/android/app/contentsafety/ContentSafetyManager#constants) \| [Methods](https://developer.android.com/reference/android/app/contentsafety/ContentSafetyManager#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/contentsafety/ContentSafetyManager#inhmethods)

# ContentSafetyManager

*** ** * ** ***


`
public

final

class
ContentSafetyManager
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.contentsafety.ContentSafetyManager |

<br />

*** ** * ** ***

The ContentSafetyManager provides access to content safety features.

## Summary

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/app/contentsafety/ContentSafetyManager#ACTION_SHOW_RESTRICTED_CONTENT_DETAILS` Activity Action: Launch an activity showing information about restricted content. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/app/contentsafety/ContentSafetyManager#EXTRA_CONTENT_LOCUS_ID` Extra for `https://developer.android.com/reference/android/app/contentsafety/ContentSafetyManager#ACTION_SHOW_RESTRICTED_CONTENT_DETAILS` containing the locus ID of the restricted content. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/content/Intent` | ` https://developer.android.com/reference/android/app/contentsafety/ContentSafetyManager#createContentRestrictedIntent(android.content.LocusId)(https://developer.android.com/reference/android/content/LocusId locusId) ` Creates an `https://developer.android.com/reference/android/content/Intent` that can be used with `https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent)` to display a dialog about the restricted content. |
| ` boolean` | ` https://developer.android.com/reference/android/app/contentsafety/ContentSafetyManager#isContentSafetyEnabled()() ` Returns whether content safety is currently enabled for the user. |
| ` void` | ` https://developer.android.com/reference/android/app/contentsafety/ContentSafetyManager#requestContentClassification(android.app.contentsafety.ClassifiableContent,%20java.util.concurrent.Executor,%20android.app.contentsafety.ContentClassificationCallback)(https://developer.android.com/reference/android/app/contentsafety/ClassifiableContent content, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/app/contentsafety/ContentClassificationCallback callback) ` Requests classification of the specified content. |

### 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

### ACTION_SHOW_RESTRICTED_CONTENT_DETAILS

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final String ACTION_SHOW_RESTRICTED_CONTENT_DETAILS
```

Activity Action: Launch an activity showing information about restricted content.

Apps holding the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_CONTENT_SAFETY` must declare an
activity that handles this action to show specific content restriction details.

<br />

Constant Value:

"android.app.contentsafety.action.SHOW_RESTRICTED_CONTENT_DETAILS"


### EXTRA_CONTENT_LOCUS_ID

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final String EXTRA_CONTENT_LOCUS_ID
```

Extra for `https://developer.android.com/reference/android/app/contentsafety/ContentSafetyManager#ACTION_SHOW_RESTRICTED_CONTENT_DETAILS` containing the locus ID of the
restricted content.

<br />

Constant Value:

"android.app.contentsafety.extra.CONTENT_LOCUS_ID"


## Public methods

### createContentRestrictedIntent

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public Intent createContentRestrictedIntent (LocusId locusId)
```

Creates an `https://developer.android.com/reference/android/content/Intent` that can be used with `https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent)` to
display a dialog about the restricted content.

<br />

| Parameters ||
|---|---|
| `locusId` | `LocusId`: the `https://developer.android.com/reference/android/content/LocusId` of the content to be restricted. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/Intent` | the intent to display the restricted content dialog. This value may be `null`. <br /> |

### isContentSafetyEnabled

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean isContentSafetyEnabled ()
```

Returns whether content safety is currently enabled for the user.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if content safety is enabled for the user, `false` otherwise <br /> |

### requestContentClassification

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void requestContentClassification (ClassifiableContent content, 
                Executor executor, 
                ContentClassificationCallback callback)
```

Requests classification of the specified content.

When content safety is enabled, this method determines if the specified content is
appropriate based on the user's settings.

If the content is classified, the result provided to the callback will have a
classification type of `https://developer.android.com/reference/android/app/contentsafety/ContentClassificationResult#TYPE_ALLOWED`, `https://developer.android.com/reference/android/app/contentsafety/ContentClassificationResult#TYPE_WARNING`, or `https://developer.android.com/reference/android/app/contentsafety/ContentClassificationResult#TYPE_BLOCKED`. If the content could not be classified or if
content safety is disabled, the classification type will be `https://developer.android.com/reference/android/app/contentsafety/ContentClassificationResult#TYPE_UNCLASSIFIED`.

<br />

| Parameters ||
|---|---|
| `content` | `ClassifiableContent`: the content to be classified. This value cannot be `null`. <br /> |
| `executor` | `Executor`: the executor on which to run the callback. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `ContentClassificationCallback`: the callback to receive the classification result. This value cannot be `null`. <br /> |