# EditorSession

Artifact: [androidx.wear.watchface:watchface-editor](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/editor/EditorSession.kt+class:androidx.wear.watchface.editor.EditorSession) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

*** ** * ** ***


```
public interface EditorSession extends AutoCloseable
```

<br />

Known direct subclasses [ListenableEditorSession](https://developer.android.com/reference/androidx/wear/watchface/editor/ListenableEditorSession)

|---|---|
| `https://developer.android.com/reference/androidx/wear/watchface/editor/ListenableEditorSession` | **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

*** ** * ** ***

> [!CAUTION]
> **This interface is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Interface for manipulating watch face state during a watch face editing session. The editor should adjust `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#userStyle()` and call `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#openComplicationDataSourceChooser(kotlin.Int)` to configure the watch face and call `https://developer.android.com/reference/java/lang/AutoCloseable.html#close()` when done. This reports the updated `https://developer.android.com/reference/androidx/wear/watchface/client/EditorState` to the `https://developer.android.com/reference/androidx/wear/watchface/client/EditorListener`s registered via `https://developer.android.com/reference/androidx/wear/watchface/client/EditorServiceClient#addListener(androidx.wear.watchface.client.EditorListener,java.util.concurrent.Executor)`.

For EditorSessions backed by a headless instance (see `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#createHeadlessEditorSession(androidx.activity.ComponentActivity,android.content.Intent,androidx.wear.watchface.client.HeadlessWatchFaceClient)` and `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorRequest#headlessDeviceConfig()`), style changes are not applied to the interactive instance and it's up to the system to apply them. For EditorSessions backed by an interactive instance style changes are applied immediately. Its possible the system might fail to persist the style changes (e.g. to data base write failure or a crash) and if this happens it's the responsibility of the system to revert the style change.

use Watch Face Format instead

## Summary

| ### Public fields |
|---|---|
| `default static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#DEFAULT_PREVIEW_INSTANT()` **This field is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `default static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Duration.html` | `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#EDITING_SESSION_TIMEOUT()` **This field is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public methods |
|---|---|
| `default static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 27) @https://developer.android.com/reference/androidx/annotation/UiThread [createHeadlessEditorSession](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#createHeadlessEditorSession(androidx.activity.ComponentActivity,android.content.Intent,androidx.wear.watchface.client.HeadlessWatchFaceClient))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/activity/ComponentActivity activity, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Intent.html editIntent, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/client/HeadlessWatchFaceClient headlessWatchFaceClient )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `default static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession` | `@https://developer.android.com/reference/androidx/annotation/UiThread [createOnWatchEditorSession](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#createOnWatchEditorSession(androidx.activity.ComponentActivity))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/activity/ComponentActivity activity)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract https://developer.android.com/reference/java/lang/Integer.html` | `[getBackgroundComplicationSlotId](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getBackgroundComplicationSlotId())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract https://developer.android.com/reference/java/lang/Integer.html` | `@https://developer.android.com/reference/androidx/annotation/UiThread [getComplicationSlotIdAt](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getComplicationSlotIdAt(kotlin.Int,kotlin.Int))(@https://developer.android.com/reference/androidx/annotation/Px int x, @https://developer.android.com/reference/androidx/annotation/Px int y)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/client/ComplicationSlotState>>` | `[getComplicationSlotsState](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getComplicationSlotsState())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationDataSourceInfo>>` | `[getComplicationsDataSourceInfo](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getComplicationsDataSourceInfo())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData>>` | `[getComplicationsPreviewData](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getComplicationsPreviewData())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html` | `[getPreviewReferenceInstant](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getPreviewReferenceInstant())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-mutable-state-flow/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle>` | `[getUserStyle](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getUserStyle())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema` | `[getUserStyleSchema](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getUserStyleSchema())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/ComponentName.html` | `[getWatchFaceComponentName](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getWatchFaceComponentName())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/client/WatchFaceId` | `[getWatchFaceId](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getWatchFaceId())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract boolean` | `@https://developer.android.com/reference/androidx/annotation/UiThread [isCommitChangesOnClose](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#isCommitChangesOnClose())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract https://developer.android.com/reference/androidx/wear/watchface/editor/ChosenComplicationDataSource` | `@https://developer.android.com/reference/androidx/annotation/UiThread [openComplicationDataSourceChooser](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#openComplicationDataSourceChooser(kotlin.Int))(int complicationSlotId)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Bitmap.html` | `@https://developer.android.com/reference/androidx/annotation/UiThread [renderWatchFaceToBitmap](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#renderWatchFaceToBitmap(androidx.wear.watchface.RenderParameters,java.time.Instant,kotlin.collections.Map))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/RenderParameters renderParameters, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html instant, https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData> slotIdToComplicationData )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/UiThread [setCommitChangesOnClose](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#setCommitChangesOnClose(kotlin.Boolean))(boolean value)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `default void` | `[setOverrideComplications](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#setOverrideComplications(kotlin.collections.Map))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData> slotIdToComplicationData )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Inherited methods |
|---|
| From [java.lang.AutoCloseable](https://developer.android.com/reference/java/lang/AutoCloseable.html) |---|---| | `abstract void` | `[close](https://developer.android.com/reference/java/lang/AutoCloseable.html#close())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. | |

## Public fields

### DEFAULT_PREVIEW_INSTANT

```
default static final @NonNull Instant DEFAULT_PREVIEW_INSTANT
```

> [!CAUTION]
> **This field is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

If passed `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#renderWatchFaceToBitmap(androidx.wear.watchface.RenderParameters,java.time.Instant,kotlin.collections.Map)` this will signal that the watch face's default preview time should be used.

### EDITING_SESSION_TIMEOUT

```
default static final @NonNull Duration EDITING_SESSION_TIMEOUT
```

> [!CAUTION]
> **This field is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Timeout allowed for waiting for creating the watch face editing session.

## Public methods

### createHeadlessEditorSession

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@RequiresApi(value = 27)
@UiThread
default static final @NonNull EditorSession [createHeadlessEditorSession](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#createHeadlessEditorSession(androidx.activity.ComponentActivity,android.content.Intent,androidx.wear.watchface.client.HeadlessWatchFaceClient))(
    @NonNull ComponentActivity activity,
    @NonNull Intent editIntent,
    @NonNull HeadlessWatchFaceClient headlessWatchFaceClient
)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Constructs an `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession` for a remote watch face editor.

Caution the remote watchface must have been built with the same version of the watch face libraries.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/activity/ComponentActivity activity` | The `https://developer.android.com/reference/androidx/activity/ComponentActivity` associated with the EditorSession. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Intent.html editIntent` | The `https://developer.android.com/reference/android/content/Intent.html` sent by SysUI to launch the editing session. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/client/HeadlessWatchFaceClient headlessWatchFaceClient` | The `https://developer.android.com/reference/androidx/wear/watchface/client/HeadlessWatchFaceClient` to use for rendering etc... |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession` | The `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession` or `null` if it could not be constructed. |

### createOnWatchEditorSession

```
@UiThread
default static final @NonNull EditorSession [createOnWatchEditorSession](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#createOnWatchEditorSession(androidx.activity.ComponentActivity))(@NonNull ComponentActivity activity)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Constructs an `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession` for an on watch face editor. This registers an activity result handler and so it must be called during an Activity or Fragment initialization path. The EditorSession is lifecycle aware and will automatically close when onDestroy is received.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/activity/ComponentActivity activity` | The `https://developer.android.com/reference/androidx/activity/ComponentActivity` associated with the `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession`. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession` | Deferred which is resolved with either the `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession` or `null` if it can't be constructed. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-timeout-cancellation-exception/index.html` | if it takes longer than `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#EDITING_SESSION_TIMEOUT()` to create a watch face editor. |

### getBackgroundComplicationSlotId

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
abstract Integer [getBackgroundComplicationSlotId](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getBackgroundComplicationSlotId())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The ID of the background complication or `null` if there isn't one.

### getComplicationSlotIdAt

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@UiThread
abstract Integer [getComplicationSlotIdAt](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getComplicationSlotIdAt(kotlin.Int,kotlin.Int))(@Px int x, @Px int y)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Returns the ID of the complication at the given coordinates or `null` if there isn't one. Only `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot`s with `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotBoundsType#ROUND_RECT()` are supported by this function.

### getComplicationSlotsState

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
abstract @NonNull StateFlow<@NonNull Map<@NonNull Integer, @NonNull ComplicationSlotState>> [getComplicationSlotsState](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getComplicationSlotsState())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

A `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` of a Map of complication slot ids to `https://developer.android.com/reference/androidx/wear/watchface/client/ComplicationSlotState` for each complication slot.

If accessed from java, consider using androidx.lifecycle.FlowLiveDataConversions.asLiveData to observe changes.

### getComplicationsDataSourceInfo

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
abstract @NonNull StateFlow<@NonNull Map<@NonNull Integer, ComplicationDataSourceInfo>> [getComplicationsDataSourceInfo](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getComplicationsDataSourceInfo())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Returns a flow of maps of `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` ids to `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationDataSourceInfo` that represent the information available about the data source for each complication. This data is fetched asynchronously and the map will initially be empty. For watch faces without complications this will always be empty.

Note new data may be pushed as result of running `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#openComplicationDataSourceChooser(kotlin.Int)`.

Note a `null` `https://developer.android.com/reference/androidx/wear/watchface/complications/ComplicationDataSourceInfo` will be associated with a complication slot id if the `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` is configured to show the empty complication data source.

### getComplicationsPreviewData

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
abstract @NonNull StateFlow<@NonNull Map<@NonNull Integer, @NonNull ComplicationData>> [getComplicationsPreviewData](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getComplicationsPreviewData())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Returns a flow of maps of `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` ids to preview `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData` suitable for use in rendering a preview of the watch face. This data is fetched asynchronously and the map will initially be empty. For watch faces without complications this will always be empty.

Note new data may be pushed as a result of running `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#openComplicationDataSourceChooser(kotlin.Int)`.

Note if a slot is configured to be empty then the map will contain an instance of `https://developer.android.com/reference/androidx/wear/watchface/complications/data/EmptyComplicationData` for that slot. Disabled complicationSlots are included in the map.

If accessed from java, consider using androidx.lifecycle.FlowLiveDataConversions.asLiveData to observe changes.

### getPreviewReferenceInstant

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
abstract @NonNull Instant [getPreviewReferenceInstant](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getPreviewReferenceInstant())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The reference preview `https://developer.android.com/reference/java/time/Instant.html` for this watch face to render previews with.

### getUserStyle

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
abstract @NonNull MutableStateFlow<@NonNull UserStyle> [getUserStyle](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getUserStyle())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The current `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyle`. Assigning to this will cause the style to update. However, styling changes to the watch face will be reverted upon exit.

If accessed from java, consider using androidx.lifecycle.FlowLiveDataConversions.asLiveData to observe changes.

### getUserStyleSchema

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
abstract @NonNull UserStyleSchema [getUserStyleSchema](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getUserStyleSchema())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The watch face's `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema`.

### getWatchFaceComponentName

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
abstract @NonNull ComponentName [getWatchFaceComponentName](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getWatchFaceComponentName())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The `https://developer.android.com/reference/android/content/ComponentName.html` of the watch face being edited.

### getWatchFaceId

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
abstract @NonNull WatchFaceId [getWatchFaceId](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#getWatchFaceId())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Unique ID for the instance of the watch face being edited. Note each distinct `https://developer.android.com/reference/android/content/ComponentName.html` can sometimes have multiple instances. See `https://developer.android.com/reference/androidx/wear/watchface/client/WatchFaceId` for more details.

### isCommitChangesOnClose

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@UiThread
abstract boolean [isCommitChangesOnClose](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#isCommitChangesOnClose())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Whether any changes should be committed when the session is closed (defaults to `true`).

Note due to SysUI requirements `https://developer.android.com/reference/androidx/wear/watchface/client/EditorState` can't reliably be sent in the activity result because there are circumstances where `https://developer.android.com/reference/android/app/Activity.html#onStop()` doesn't get called but the UX requires us to commit changes.

Regardless of the value, on completion of the editor session, the original UserStyle is restored. Note we need SysUI's help to revert any complication data source changes. Caveat some complication data sources have their own config (e.g. the world clock has a timezone setting) and that config currently can't be reverted.

### openComplicationDataSourceChooser

```
@UiThread
abstract ChosenComplicationDataSource [openComplicationDataSourceChooser](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#openComplicationDataSourceChooser(kotlin.Int))(int complicationSlotId)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Opens the complication data source chooser and returns the chosen complication data source for the specified `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot`.

The result returns `null` if the operation was cancelled and otherwise returned an instance of `https://developer.android.com/reference/androidx/wear/watchface/editor/ChosenComplicationDataSource` that contains information about the chosen data source.

| Parameters |
|---|---|
| `int complicationSlotId` | The id of the `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` to select a complication data source for. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if a previous invocation of openComplicationDataSourceChooser is still running when openComplicationDataSourceChooser is called. |

### renderWatchFaceToBitmap

```
@UiThread
abstract @NonNull Bitmap [renderWatchFaceToBitmap](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#renderWatchFaceToBitmap(androidx.wear.watchface.RenderParameters,java.time.Instant,kotlin.collections.Map))(
    @NonNull RenderParameters renderParameters,
    @NonNull Instant instant,
    Map<@NonNull Integer, @NonNull ComplicationData> slotIdToComplicationData
)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Renders the watch face to a `https://developer.android.com/reference/android/graphics/Bitmap.html` using the current `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#userStyle()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/RenderParameters renderParameters` | The `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters` to render with. Must be `https://developer.android.com/reference/androidx/wear/watchface/DrawMode#INTERACTIVE` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html instant` | The `https://developer.android.com/reference/java/time/Instant.html` to render with |
| `https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData> slotIdToComplicationData` | Override `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData` for each `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` to render with. Note using this feature is somewhat computationally expensive because under the hood it saves and restores the backing watch face instance's complications. If you need to render multiple times with the same slotIdToComplicationData, consider using `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#renderWatchFaceToBitmap(androidx.wear.watchface.RenderParameters,java.time.Instant,kotlin.collections.Map)` for a more efficient alternative. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Bitmap.html` | A `https://developer.android.com/reference/android/graphics/Bitmap.html` containing the screen shot with the specified parameters |

### setCommitChangesOnClose

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@UiThread
abstract void [setCommitChangesOnClose](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#setCommitChangesOnClose(kotlin.Boolean))(boolean value)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Whether any changes should be committed when the session is closed (defaults to `true`).

Note due to SysUI requirements `https://developer.android.com/reference/androidx/wear/watchface/client/EditorState` can't reliably be sent in the activity result because there are circumstances where `https://developer.android.com/reference/android/app/Activity.html#onStop()` doesn't get called but the UX requires us to commit changes.

Regardless of the value, on completion of the editor session, the original UserStyle is restored. Note we need SysUI's help to revert any complication data source changes. Caveat some complication data sources have their own config (e.g. the world clock has a timezone setting) and that config currently can't be reverted.

### setOverrideComplications

```
default void [setOverrideComplications](https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#setOverrideComplications(kotlin.collections.Map))(
    @NonNull Map<@NonNull Integer, @NonNull ComplicationData> slotIdToComplicationData
)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

For the duration of the editor session, applies an override to complications rendered via `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#renderWatchFaceToBitmap(androidx.wear.watchface.RenderParameters,java.time.Instant,kotlin.collections.Map)`. If you need to render multiple times with the same `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#setOverrideComplications(kotlin.collections.Map)` it's more efficient to use this API and call `https://developer.android.com/reference/androidx/wear/watchface/editor/EditorSession#renderWatchFaceToBitmap(androidx.wear.watchface.RenderParameters,java.time.Instant,kotlin.collections.Map)` with null slotIdToComplicationData. When the editor session ends this override will be removed.

Note if after this call updated complications are sent via `https://developer.android.com/reference/androidx/wear/watchface/client/InteractiveWatchFaceClient#updateComplicationData(kotlin.collections.Map)`, they will only be applied once the editor session has ended.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData> slotIdToComplicationData` | The complications you wish to set. Any slots not covered by this map will be unchanged. |