# SessionObserverFactoryRegistry

Artifact: [androidx.privacysandbox.ui:ui-provider](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ui) [View Source](https://cs.android.com/search?q=file:androidx/privacysandbox/ui/provider/SessionObserverFactoryRegistry.kt+class:androidx.privacysandbox.ui.provider.SessionObserverFactoryRegistry) Added in [1.0.0-alpha17](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ui#1.0.0-alpha17) Deprecated in [1.0.0-alpha17](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ui#1.0.0-alpha17)

*** ** * ** ***


```
public interface SessionObserverFactoryRegistry
```

<br />

Known direct subclasses [AbstractSandboxedUiAdapter](https://developer.android.com/reference/androidx/privacysandbox/ui/provider/AbstractSandboxedUiAdapter)

|---|---|
| `https://developer.android.com/reference/androidx/privacysandbox/ui/provider/AbstractSandboxedUiAdapter` | **This class is deprecated.** This library is no longer supported. |

*** ** * ** ***

> [!CAUTION]
> **This interface is deprecated.**   
> This library is no longer supported.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `[addObserverFactory](https://developer.android.com/reference/androidx/privacysandbox/ui/provider/SessionObserverFactoryRegistry#addObserverFactory(androidx.privacysandbox.ui.core.SessionObserverFactory))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserverFactory sessionObserverFactory )` **This method is deprecated.** This library is no longer supported. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserverFactory>` | `[getSessionObserverFactories](https://developer.android.com/reference/androidx/privacysandbox/ui/provider/SessionObserverFactoryRegistry#getSessionObserverFactories())()` **This method is deprecated.** This library is no longer supported. |
| `abstract void` | `[removeObserverFactory](https://developer.android.com/reference/androidx/privacysandbox/ui/provider/SessionObserverFactoryRegistry#removeObserverFactory(androidx.privacysandbox.ui.core.SessionObserverFactory))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserverFactory sessionObserverFactory )` **This method is deprecated.** This library is no longer supported. |

## Public methods

### addObserverFactory

Added in [1.0.0-alpha17](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ui#1.0.0-alpha17) Deprecated in [1.0.0-alpha17](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ui#1.0.0-alpha17)

```
abstract void [addObserverFactory](https://developer.android.com/reference/androidx/privacysandbox/ui/provider/SessionObserverFactoryRegistry#addObserverFactory(androidx.privacysandbox.ui.core.SessionObserverFactory))(
    @NonNull SessionObserverFactory sessionObserverFactory
)
```

> [!CAUTION]
> **This method is deprecated.**   
> This library is no longer supported.

Adds a `https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserverFactory` for tracking UI presentation state across UI sessions. This has no effect on already open sessions.

For each session that is created for the adapter after this call returns, `https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserverFactory#create()` will be invoked to allow a new `https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserver` instance to be attached to the UI session. This `https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserver` will receive UI updates for the lifetime of the session. A separate `https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserverFactory#create()` call will be made for each UI session.

### getSessionObserverFactories

Added in [1.0.0-alpha17](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ui#1.0.0-alpha17) Deprecated in [1.0.0-alpha17](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ui#1.0.0-alpha17)

```
abstract @NonNull List<@NonNull SessionObserverFactory> [getSessionObserverFactories](https://developer.android.com/reference/androidx/privacysandbox/ui/provider/SessionObserverFactoryRegistry#getSessionObserverFactories())()
```

> [!CAUTION]
> **This method is deprecated.**   
> This library is no longer supported.

### removeObserverFactory

Added in [1.0.0-alpha17](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ui#1.0.0-alpha17) Deprecated in [1.0.0-alpha17](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ui#1.0.0-alpha17)

```
abstract void [removeObserverFactory](https://developer.android.com/reference/androidx/privacysandbox/ui/provider/SessionObserverFactoryRegistry#removeObserverFactory(androidx.privacysandbox.ui.core.SessionObserverFactory))(
    @NonNull SessionObserverFactory sessionObserverFactory
)
```

> [!CAUTION]
> **This method is deprecated.**   
> This library is no longer supported.

Removes a `https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserverFactory`, if it has been previously added with `https://developer.android.com/reference/androidx/privacysandbox/ui/provider/SessionObserverFactoryRegistry#addObserverFactory(androidx.privacysandbox.ui.core.SessionObserverFactory)`.

If the `https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserverFactory` was not previously added, no action is performed. Any existing `https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserver` instances that have been created by the `https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserverFactory` will continue to receive updates until their corresponding UI session has been closed. For any subsequent sessions created\], no call to `https://developer.android.com/reference/androidx/privacysandbox/ui/core/SessionObserverFactory#create()` will be made.