public final class EditorRequest


The request sent by WatchFaceEditorContract.createIntent.

Summary

Public constructors

EditorRequest(
    @NonNull ComponentName watchFaceComponentName,
    @NonNull String editorPackageName,
    UserStyleData initialUserStyle
)

Constructs an EditorRequest without a WatchFaceId.

@RequiresApi(value = 30)
EditorRequest(
    @NonNull ComponentName watchFaceComponentName,
    @NonNull String editorPackageName,
    UserStyleData initialUserStyle,
    @NonNull WatchFaceId watchFaceId,
    DeviceConfig headlessDeviceConfig,
    PreviewScreenshotParams previewScreenshotParams
)

Public methods

static final @NonNull EditorRequest

Returns an EditorRequest saved to a Intent by WatchFaceEditorContract.createIntent if there is one or null otherwise.

final @NonNull String

The package name of the watch face editor APK.

final DeviceConfig

If non-null then this is the DeviceConfig to use when creating a headless instance to back the EditorSession.

final UserStyleData

The initial UserStyle stored as a UserStyleData or null.

final PreviewScreenshotParams

If non-null then EditorSession upon closing will render a screenshot with PreviewScreenshotParams using the existing interactive or headless instance which will be sent in EditorState to any registered clients.

final @NonNull ComponentName

The ComponentName of the watch face being edited.

final @NonNull WatchFaceId
@RequiresApi(value = 30)
getWatchFaceId()

Unique ID for the instance of the watch face being edited, only defined for Android R and beyond, it's null on Android P and earlier.

Public constructors

EditorRequest

Added in 1.0.0
public EditorRequest(
    @NonNull ComponentName watchFaceComponentName,
    @NonNull String editorPackageName,
    UserStyleData initialUserStyle
)

Constructs an EditorRequest without a WatchFaceId. This is for use pre-android R.

Parameters
@NonNull ComponentName watchFaceComponentName

The ComponentName of the watch face being edited.

@NonNull String editorPackageName

The package name of the watch face editor APK.

UserStyleData initialUserStyle

The initial UserStyle stored as a UserStyleData or null. Only required for a headless EditorSession. EditorSession.

EditorRequest

Added in 1.0.0
@RequiresApi(value = 30)
public EditorRequest(
    @NonNull ComponentName watchFaceComponentName,
    @NonNull String editorPackageName,
    UserStyleData initialUserStyle,
    @NonNull WatchFaceId watchFaceId,
    DeviceConfig headlessDeviceConfig,
    PreviewScreenshotParams previewScreenshotParams
)
Parameters
@NonNull ComponentName watchFaceComponentName

The ComponentName of the watch face being edited.

@NonNull String editorPackageName

The package name of the watch face editor APK.

UserStyleData initialUserStyle

The initial UserStyle stored as a UserStyleData or null. Only required for a headless EditorSession.

@NonNull WatchFaceId watchFaceId

Unique ID for the instance of the watch face being edited, only defined for Android R and beyond, it's null on Android P and earlier. Note each distinct ComponentName can have multiple instances.

DeviceConfig headlessDeviceConfig

If non-null then this is the DeviceConfig to use when creating a headless instance to back the EditorSession. If null then the current interactive instance will be used. If there isn't one then the EditorSession won't launch until it's been created. Note supportsWatchFaceHeadlessEditing can be used to determine if this feature is supported. If it's not supported this parameter will be ignored.

PreviewScreenshotParams previewScreenshotParams

If non-null then EditorSession upon closing will render a screenshot with PreviewScreenshotParams using the existing interactive or headless instance which will be sent in EditorState to any registered clients.

Public methods

createFromIntent

Added in 1.0.0
public static final @NonNull EditorRequest createFromIntent(@NonNull Intent intent)

Returns an EditorRequest saved to a Intent by WatchFaceEditorContract.createIntent if there is one or null otherwise. Intended for use by the watch face editor activity.

getEditorPackageName

Added in 1.0.0
public final @NonNull String getEditorPackageName()

The package name of the watch face editor APK.

getHeadlessDeviceConfig

Added in 1.0.0
public final DeviceConfig getHeadlessDeviceConfig()

If non-null then this is the DeviceConfig to use when creating a headless instance to back the EditorSession. If null then the current interactive instance will be used. If there isn't one then the EditorSession won't launch until it's been created. Note supportsWatchFaceHeadlessEditing can be used to determine if this feature is supported. If it's not supported this parameter will be ignored.

getInitialUserStyle

Added in 1.0.0
public final UserStyleData getInitialUserStyle()

The initial UserStyle stored as a UserStyleData or null. Only required for a headless EditorSession.

getPreviewScreenshotParams

Added in 1.0.0
public final PreviewScreenshotParams getPreviewScreenshotParams()

If non-null then EditorSession upon closing will render a screenshot with PreviewScreenshotParams using the existing interactive or headless instance which will be sent in EditorState to any registered clients.

getWatchFaceComponentName

Added in 1.0.0
public final @NonNull ComponentName getWatchFaceComponentName()

The ComponentName of the watch face being edited.

getWatchFaceId

Added in 1.0.0
@RequiresApi(value = 30)
public final @NonNull WatchFaceId getWatchFaceId()

Unique ID for the instance of the watch face being edited, only defined for Android R and beyond, it's null on Android P and earlier. Note each distinct ComponentName can have multiple instances.